Class: MistApi::WebhookDelivery

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

Overview

WebhookDelivery 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(error = SKIP, id = SKIP, org_id = SKIP, req_headers = SKIP, req_payload = SKIP, req_url = SKIP, resp_body = SKIP, resp_headers = SKIP, site_id = SKIP, status = SKIP, status_code = SKIP, timestamp = SKIP, topic = SKIP, webhook_id = SKIP) ⇒ WebhookDelivery

Returns a new instance of WebhookDelivery.



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

def initialize(error = SKIP, id = SKIP, org_id = SKIP, req_headers = SKIP,
               req_payload = SKIP, req_url = SKIP, resp_body = SKIP,
               resp_headers = SKIP, site_id = SKIP, status = SKIP,
               status_code = SKIP, timestamp = SKIP, topic = SKIP,
               webhook_id = SKIP)
  @error = error unless error == SKIP
  @id = id unless id == SKIP
  @org_id = org_id unless org_id == SKIP
  @req_headers = req_headers unless req_headers == SKIP
  @req_payload = req_payload unless req_payload == SKIP
  @req_url = req_url unless req_url == SKIP
  @resp_body = resp_body unless resp_body == SKIP
  @resp_headers = resp_headers unless resp_headers == SKIP
  @site_id = site_id unless site_id == SKIP
  @status = status unless status == SKIP
  @status_code = status_code unless status_code == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @topic = topic unless topic == SKIP
  @webhook_id = webhook_id unless webhook_id == SKIP
end

Instance Attribute Details

#errorString

Error message, if there is one

Returns:

  • (String)


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

def error
  @error
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#org_idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#req_headersString

HTTP request headers

Returns:

  • (String)


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

def req_headers
  @req_headers
end

#req_payloadString

HTTP request payload

Returns:

  • (String)


30
31
32
# File 'lib/mist_api/models/webhook_delivery.rb', line 30

def req_payload
  @req_payload
end

#req_urlString

HTTP request URL

Returns:

  • (String)


34
35
36
# File 'lib/mist_api/models/webhook_delivery.rb', line 34

def req_url
  @req_url
end

#resp_bodyString

HTTP response body

Returns:

  • (String)


38
39
40
# File 'lib/mist_api/models/webhook_delivery.rb', line 38

def resp_body
  @resp_body
end

#resp_headersString

HTTP response headers

Returns:

  • (String)


42
43
44
# File 'lib/mist_api/models/webhook_delivery.rb', line 42

def resp_headers
  @resp_headers
end

#site_idUUID | String

HTTP response headers

Returns:

  • (UUID | String)


46
47
48
# File 'lib/mist_api/models/webhook_delivery.rb', line 46

def site_id
  @site_id
end

#statusWebhookDeliveryStatusEnum

webhook delivery status. enum: ‘failure`, `success`



50
51
52
# File 'lib/mist_api/models/webhook_delivery.rb', line 50

def status
  @status
end

#status_codeInteger

webhook delivery status. enum: ‘failure`, `success`

Returns:

  • (Integer)


54
55
56
# File 'lib/mist_api/models/webhook_delivery.rb', line 54

def status_code
  @status_code
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


58
59
60
# File 'lib/mist_api/models/webhook_delivery.rb', line 58

def timestamp
  @timestamp
end

#topicWebhookDeliveryTopicEnum

webhook topic. enum: ‘alarms`, `audits`, `device-updowns`, `occupancy-alerts`, `ping`



63
64
65
# File 'lib/mist_api/models/webhook_delivery.rb', line 63

def topic
  @topic
end

#webhook_idUUID | String

webhook topic. enum: ‘alarms`, `audits`, `device-updowns`, `occupancy-alerts`, `ping`

Returns:

  • (UUID | String)


68
69
70
# File 'lib/mist_api/models/webhook_delivery.rb', line 68

def webhook_id
  @webhook_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



137
138
139
140
141
142
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
# File 'lib/mist_api/models/webhook_delivery.rb', line 137

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  error = hash.key?('error') ? hash['error'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  req_headers = hash.key?('req_headers') ? hash['req_headers'] : SKIP
  req_payload = hash.key?('req_payload') ? hash['req_payload'] : SKIP
  req_url = hash.key?('req_url') ? hash['req_url'] : SKIP
  resp_body = hash.key?('resp_body') ? hash['resp_body'] : SKIP
  resp_headers = hash.key?('resp_headers') ? hash['resp_headers'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  status_code = hash.key?('status_code') ? hash['status_code'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  topic = hash.key?('topic') ? hash['topic'] : SKIP
  webhook_id = hash.key?('webhook_id') ? hash['webhook_id'] : SKIP

  # Create object from extracted values.
  WebhookDelivery.new(error,
                      id,
                      org_id,
                      req_headers,
                      req_payload,
                      req_url,
                      resp_body,
                      resp_headers,
                      site_id,
                      status,
                      status_code,
                      timestamp,
                      topic,
                      webhook_id)
end

.namesObject

A mapping from model property names to API property names.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/mist_api/models/webhook_delivery.rb', line 71

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['error'] = 'error'
  @_hash['id'] = 'id'
  @_hash['org_id'] = 'org_id'
  @_hash['req_headers'] = 'req_headers'
  @_hash['req_payload'] = 'req_payload'
  @_hash['req_url'] = 'req_url'
  @_hash['resp_body'] = 'resp_body'
  @_hash['resp_headers'] = 'resp_headers'
  @_hash['site_id'] = 'site_id'
  @_hash['status'] = 'status'
  @_hash['status_code'] = 'status_code'
  @_hash['timestamp'] = 'timestamp'
  @_hash['topic'] = 'topic'
  @_hash['webhook_id'] = 'webhook_id'
  @_hash
end

.nullablesObject

An array for nullable fields



111
112
113
# File 'lib/mist_api/models/webhook_delivery.rb', line 111

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    error
    id
    org_id
    req_headers
    req_payload
    req_url
    resp_body
    resp_headers
    site_id
    status
    status_code
    timestamp
    topic
    webhook_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



184
185
186
187
188
189
190
191
192
# File 'lib/mist_api/models/webhook_delivery.rb', line 184

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} error: #{@error.inspect}, id: #{@id.inspect}, org_id: #{@org_id.inspect},"\
  " req_headers: #{@req_headers.inspect}, req_payload: #{@req_payload.inspect}, req_url:"\
  " #{@req_url.inspect}, resp_body: #{@resp_body.inspect}, resp_headers:"\
  " #{@resp_headers.inspect}, site_id: #{@site_id.inspect}, status: #{@status.inspect},"\
  " status_code: #{@status_code.inspect}, timestamp: #{@timestamp.inspect}, topic:"\
  " #{@topic.inspect}, webhook_id: #{@webhook_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



174
175
176
177
178
179
180
181
# File 'lib/mist_api/models/webhook_delivery.rb', line 174

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} error: #{@error}, id: #{@id}, org_id: #{@org_id}, req_headers:"\
  " #{@req_headers}, req_payload: #{@req_payload}, req_url: #{@req_url}, resp_body:"\
  " #{@resp_body}, resp_headers: #{@resp_headers}, site_id: #{@site_id}, status: #{@status},"\
  " status_code: #{@status_code}, timestamp: #{@timestamp}, topic: #{@topic}, webhook_id:"\
  " #{@webhook_id}>"
end