Class: DSP::Message

Inherits:
DSPBase show all
Defined in:
lib/dsp/dsp_protocol.rb

Overview

interface Message

    /** Unique identifier for the message. */
    id: number;
    /** A format string for the message. Embedded variables have the form '{name'.
        If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes.
    */
    format: string;
    /** An object used as a dictionary for looking up the variables in the format string. */
    variables?: {
        [key: string]: string;
    };
    /** If true send to telemetry. */
    sendTelemetry?: boolean;
    /** If true show user. */
    showUser?: boolean;
    /** An optional url where additional information about this message can be found. */
    url?: string;
    /** An optional label that is presented to the user as the UI for opening the url. */
    urlLabel?: string;
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ Message

Returns a new instance of Message.



3747
3748
3749
3750
# File 'lib/dsp/dsp_protocol.rb', line 3747

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[variables sendTelemetry showUser url urlLabel]
end

Instance Attribute Details

#formatObject

type: number # type: string # type: {



3742
3743
3744
# File 'lib/dsp/dsp_protocol.rb', line 3742

def format
  @format
end

#idObject

type: number # type: string # type: {



3742
3743
3744
# File 'lib/dsp/dsp_protocol.rb', line 3742

def id
  @id
end

#sendTelemetryObject

[key: string]: string;

}


3745
3746
3747
# File 'lib/dsp/dsp_protocol.rb', line 3745

def sendTelemetry
  @sendTelemetry
end

#showUserObject

type: number # type: string # type: {



3742
3743
3744
# File 'lib/dsp/dsp_protocol.rb', line 3742

def showUser
  @showUser
end

#urlObject

type: number # type: string # type: {



3742
3743
3744
# File 'lib/dsp/dsp_protocol.rb', line 3742

def url
  @url
end

#urlLabelObject

type: number # type: string # type: {



3742
3743
3744
# File 'lib/dsp/dsp_protocol.rb', line 3742

def urlLabel
  @urlLabel
end

#variablesObject

type: number # type: string # type: {



3742
3743
3744
# File 'lib/dsp/dsp_protocol.rb', line 3742

def variables
  @variables
end

Instance Method Details

#from_h!(value) ⇒ Object



3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
# File 'lib/dsp/dsp_protocol.rb', line 3752

def from_h!(value)
  value = {} if value.nil?
  self.id = value['id']
  self.format = value['format']
  self.variables = value['variables'] # Unknown type
  self.sendTelemetry = value['sendTelemetry'] # Unknown type
  self.showUser = value['showUser'] # Unknown type
  self.url = value['url']
  self.urlLabel = value['urlLabel']
  self
end