Class: GongAPI::ContentViewedEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/gong_api/models/content_viewed_event.rb

Overview

Content Viewed event

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ContentViewedEvent

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/gong_api/models/content_viewed_event.rb', line 143

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `GongAPI::ContentViewedEvent` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `GongAPI::ContentViewedEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'agent_platform')
    self.agent_platform = attributes[:'agent_platform']
  end

  if attributes.key?(:'content_id')
    self.content_id = attributes[:'content_id']
  end

  if attributes.key?(:'content_properties')
    if (value = attributes[:'content_properties']).is_a?(Array)
      self.content_properties = value
    end
  end

  if attributes.key?(:'content_title')
    self.content_title = attributes[:'content_title']
  end

  if attributes.key?(:'content_url')
    self.content_url = attributes[:'content_url']
  end

  if attributes.key?(:'crm_context')
    if (value = attributes[:'crm_context']).is_a?(Array)
      self.crm_context = value
    end
  end

  if attributes.key?(:'event_id')
    self.event_id = attributes[:'event_id']
  end

  if attributes.key?(:'event_properties')
    if (value = attributes[:'event_properties']).is_a?(Array)
      self.event_properties = value
    end
  end

  if attributes.key?(:'event_timestamp')
    self.event_timestamp = attributes[:'event_timestamp']
  end

  if attributes.key?(:'mobile_app_id')
    self.mobile_app_id = attributes[:'mobile_app_id']
  end

  if attributes.key?(:'reporting_system')
    self.reporting_system = attributes[:'reporting_system']
  end

  if attributes.key?(:'share_id')
    self.share_id = attributes[:'share_id']
  end

  if attributes.key?(:'user_agent')
    self.user_agent = attributes[:'user_agent']
  end

  if attributes.key?(:'view_action_title')
    self.view_action_title = attributes[:'view_action_title']
  end

  if attributes.key?(:'view_info_url')
    self.view_info_url = attributes[:'view_info_url']
  end

  if attributes.key?(:'viewer')
    self.viewer = attributes[:'viewer']
  end

  if attributes.key?(:'workspace_id')
    self.workspace_id = attributes[:'workspace_id']
  end
end

Instance Attribute Details

#agent_platformObject

Platform on which the interaction was made



18
19
20
# File 'lib/gong_api/models/content_viewed_event.rb', line 18

def agent_platform
  @agent_platform
end

#content_idObject

The id of the content that was viewed in the reporting system.



21
22
23
# File 'lib/gong_api/models/content_viewed_event.rb', line 21

def content_id
  @content_id
end

#content_propertiesObject

A list of additional properties for the content



24
25
26
# File 'lib/gong_api/models/content_viewed_event.rb', line 24

def content_properties
  @content_properties
end

#content_titleObject

Human readable title of the content.



27
28
29
# File 'lib/gong_api/models/content_viewed_event.rb', line 27

def content_title
  @content_title
end

#content_urlObject

The url of the content that was viewed in the reporting system. This is the url that is was accessed by the viewer.



30
31
32
# File 'lib/gong_api/models/content_viewed_event.rb', line 30

def content_url
  @content_url
end

#crm_contextObject

A list of references to external systems such as CRM, Telephony System, Case Management, etc.



33
34
35
# File 'lib/gong_api/models/content_viewed_event.rb', line 33

def crm_context
  @crm_context
end

#event_idObject

The original id of the event as designated in the reporting system.



36
37
38
# File 'lib/gong_api/models/content_viewed_event.rb', line 36

def event_id
  @event_id
end

#event_propertiesObject

A list of additional properties for the event



39
40
41
# File 'lib/gong_api/models/content_viewed_event.rb', line 39

def event_properties
  @event_properties
end

#event_timestampObject

The date and time when the event happened in the ISO-8601 format (e.g., ‘2021-08-01T02:30:00+05:00’ or ‘2021-08-01T08:00:00Z’, where Z stands for UTC);



42
43
44
# File 'lib/gong_api/models/content_viewed_event.rb', line 42

def event_timestamp
  @event_timestamp
end

#mobile_app_idObject

The application identification string in case of interaction via mobile application (bundle identifier or package name).



45
46
47
# File 'lib/gong_api/models/content_viewed_event.rb', line 45

def mobile_app_id
  @mobile_app_id
end

#reporting_systemObject

The unique identifier of the reporting system. It is the same value in all events originating from the same system.



48
49
50
# File 'lib/gong_api/models/content_viewed_event.rb', line 48

def reporting_system
  @reporting_system
end

#share_idObject

The id of the share action that corresponds to this view event, in case there can be more than one share per content.



51
52
53
# File 'lib/gong_api/models/content_viewed_event.rb', line 51

def share_id
  @share_id
end

#user_agentObject

"User-Agent" header value for browser based interaction



54
55
56
# File 'lib/gong_api/models/content_viewed_event.rb', line 54

def user_agent
  @user_agent
end

#view_action_titleObject

The name of the action like "Document Viewed" or "Presentation Opened".



57
58
59
# File 'lib/gong_api/models/content_viewed_event.rb', line 57

def view_action_title
  @view_action_title
end

#view_info_urlObject

The link to a page that presents additional information about this event.



60
61
62
# File 'lib/gong_api/models/content_viewed_event.rb', line 60

def view_info_url
  @view_info_url
end

#viewerObject

Returns the value of attribute viewer.



62
63
64
# File 'lib/gong_api/models/content_viewed_event.rb', line 62

def viewer
  @viewer
end

#workspace_idObject

Optional workspace identifier. If specified, the event will be placed into this workspace, otherwise, the default algorithm for workspace placement will be applied.



65
66
67
# File 'lib/gong_api/models/content_viewed_event.rb', line 65

def workspace_id
  @workspace_id
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/gong_api/models/content_viewed_event.rb', line 90

def self.attribute_map
  {
    :'agent_platform' => :'agentPlatform',
    :'content_id' => :'contentId',
    :'content_properties' => :'contentProperties',
    :'content_title' => :'contentTitle',
    :'content_url' => :'contentUrl',
    :'crm_context' => :'crmContext',
    :'event_id' => :'eventId',
    :'event_properties' => :'eventProperties',
    :'event_timestamp' => :'eventTimestamp',
    :'mobile_app_id' => :'mobileAppId',
    :'reporting_system' => :'reportingSystem',
    :'share_id' => :'shareId',
    :'user_agent' => :'userAgent',
    :'view_action_title' => :'viewActionTitle',
    :'view_info_url' => :'viewInfoUrl',
    :'viewer' => :'viewer',
    :'workspace_id' => :'workspaceId'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



320
321
322
# File 'lib/gong_api/models/content_viewed_event.rb', line 320

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



136
137
138
139
# File 'lib/gong_api/models/content_viewed_event.rb', line 136

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/gong_api/models/content_viewed_event.rb', line 113

def self.openapi_types
  {
    :'agent_platform' => :'Object',
    :'content_id' => :'Object',
    :'content_properties' => :'Object',
    :'content_title' => :'Object',
    :'content_url' => :'Object',
    :'crm_context' => :'Object',
    :'event_id' => :'Object',
    :'event_properties' => :'Object',
    :'event_timestamp' => :'Object',
    :'mobile_app_id' => :'Object',
    :'reporting_system' => :'Object',
    :'share_id' => :'Object',
    :'user_agent' => :'Object',
    :'view_action_title' => :'Object',
    :'view_info_url' => :'Object',
    :'viewer' => :'Object',
    :'workspace_id' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/gong_api/models/content_viewed_event.rb', line 283

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      agent_platform == o.agent_platform &&
      content_id == o.content_id &&
      content_properties == o.content_properties &&
      content_title == o.content_title &&
      content_url == o.content_url &&
      crm_context == o.crm_context &&
      event_id == o.event_id &&
      event_properties == o.event_properties &&
      event_timestamp == o.event_timestamp &&
      mobile_app_id == o.mobile_app_id &&
      reporting_system == o.reporting_system &&
      share_id == o.share_id &&
      user_agent == o.user_agent &&
      view_action_title == o.view_action_title &&
      view_info_url == o.view_info_url &&
      viewer == o.viewer &&
      workspace_id == o.workspace_id
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/gong_api/models/content_viewed_event.rb', line 350

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    GongAPI.const_get(type).build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/gong_api/models/content_viewed_event.rb', line 419

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/gong_api/models/content_viewed_event.rb', line 327

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


307
308
309
# File 'lib/gong_api/models/content_viewed_event.rb', line 307

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



313
314
315
# File 'lib/gong_api/models/content_viewed_event.rb', line 313

def hash
  [agent_platform, content_id, content_properties, content_title, content_url, crm_context, event_id, event_properties, event_timestamp, mobile_app_id, reporting_system, share_id, user_agent, view_action_title, view_info_url, viewer, workspace_id].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/gong_api/models/content_viewed_event.rb', line 233

def list_invalid_properties
  invalid_properties = Array.new
  if @content_id.nil?
    invalid_properties.push('invalid value for "content_id", content_id cannot be nil.')
  end

  if @content_title.nil?
    invalid_properties.push('invalid value for "content_title", content_title cannot be nil.')
  end

  if @content_url.nil?
    invalid_properties.push('invalid value for "content_url", content_url cannot be nil.')
  end

  if @event_timestamp.nil?
    invalid_properties.push('invalid value for "event_timestamp", event_timestamp cannot be nil.')
  end

  if @reporting_system.nil?
    invalid_properties.push('invalid value for "reporting_system", reporting_system cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



395
396
397
# File 'lib/gong_api/models/content_viewed_event.rb', line 395

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/gong_api/models/content_viewed_event.rb', line 401

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



389
390
391
# File 'lib/gong_api/models/content_viewed_event.rb', line 389

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



260
261
262
263
264
265
266
267
268
269
# File 'lib/gong_api/models/content_viewed_event.rb', line 260

def valid?
  agent_platform_validator = EnumAttributeValidator.new('Object', ['Android', 'Linux', 'MacOS', 'Windows', 'iOS'])
  return false unless agent_platform_validator.valid?(@agent_platform)
  return false if @content_id.nil?
  return false if @content_title.nil?
  return false if @content_url.nil?
  return false if @event_timestamp.nil?
  return false if @reporting_system.nil?
  true
end