Class: MistApi::WebhookPingEvent

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/webhook_ping_event.rb

Overview

WebhookPingEvent Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id = nil, name = nil, site_id = nil, timestamp = nil) ⇒ WebhookPingEvent

Returns a new instance of WebhookPingEvent.



48
49
50
51
52
53
# File 'lib/mist_api/models/webhook_ping_event.rb', line 48

def initialize(id = nil, name = nil, site_id = nil, timestamp = nil)
  @id = id
  @name = name
  @site_id = site_id
  @timestamp = timestamp
end

Instance Attribute Details

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


14
15
16
# File 'lib/mist_api/models/webhook_ping_event.rb', line 14

def id
  @id
end

#nameString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


18
19
20
# File 'lib/mist_api/models/webhook_ping_event.rb', line 18

def name
  @name
end

#site_idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


22
23
24
# File 'lib/mist_api/models/webhook_ping_event.rb', line 22

def site_id
  @site_id
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


26
27
28
# File 'lib/mist_api/models/webhook_ping_event.rb', line 26

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/mist_api/models/webhook_ping_event.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  site_id = hash.key?('site_id') ? hash['site_id'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil

  # Create object from extracted values.
  WebhookPingEvent.new(id,
                       name,
                       site_id,
                       timestamp)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/mist_api/models/webhook_ping_event.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['site_id'] = 'site_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/mist_api/models/webhook_ping_event.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
# File 'lib/mist_api/models/webhook_ping_event.rb', line 39

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/mist_api/models/webhook_ping_event.rb', line 74

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.id,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.site_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.timestamp,
                              ->(val) { val.instance_of? Float })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['id'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['site_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['timestamp'],
                            ->(val) { val.instance_of? Float })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
# File 'lib/mist_api/models/webhook_ping_event.rb', line 110

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, site_id: #{@site_id.inspect},"\
  " timestamp: #{@timestamp.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
# File 'lib/mist_api/models/webhook_ping_event.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, name: #{@name}, site_id: #{@site_id}, timestamp:"\
  " #{@timestamp}>"
end