Class: Late::WebhookLog

Inherits:
ApiModelBase show all
Defined in:
lib/late-sdk/models/webhook_log.rb

Overview

Webhook delivery log entry

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ WebhookLog

Initializes the object

Parameters:

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

    Model attributes in the form of hash



131
132
133
134
135
136
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
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
# File 'lib/late-sdk/models/webhook_log.rb', line 131

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#_idObject

Returns the value of attribute _id.



19
20
21
# File 'lib/late-sdk/models/webhook_log.rb', line 19

def _id
  @_id
end

#attempt_numberObject

Delivery attempt number (max 3 retries)



46
47
48
# File 'lib/late-sdk/models/webhook_log.rb', line 46

def attempt_number
  @attempt_number
end

#created_atObject

Returns the value of attribute created_at.



51
52
53
# File 'lib/late-sdk/models/webhook_log.rb', line 51

def created_at
  @created_at
end

#error_messageObject

Error message if delivery failed



43
44
45
# File 'lib/late-sdk/models/webhook_log.rb', line 43

def error_message
  @error_message
end

#eventObject

Returns the value of attribute event.



27
28
29
# File 'lib/late-sdk/models/webhook_log.rb', line 27

def event
  @event
end

#request_payloadObject

Payload sent to webhook endpoint



37
38
39
# File 'lib/late-sdk/models/webhook_log.rb', line 37

def request_payload
  @request_payload
end

#response_bodyObject

Response body from webhook endpoint (truncated to 10KB)



40
41
42
# File 'lib/late-sdk/models/webhook_log.rb', line 40

def response_body
  @response_body
end

#response_timeObject

Response time in milliseconds



49
50
51
# File 'lib/late-sdk/models/webhook_log.rb', line 49

def response_time
  @response_time
end

#statusObject

Returns the value of attribute status.



31
32
33
# File 'lib/late-sdk/models/webhook_log.rb', line 31

def status
  @status
end

#status_codeObject

HTTP status code from webhook endpoint



34
35
36
# File 'lib/late-sdk/models/webhook_log.rb', line 34

def status_code
  @status_code
end

#urlObject

Returns the value of attribute url.



29
30
31
# File 'lib/late-sdk/models/webhook_log.rb', line 29

def url
  @url
end

#webhook_idObject

ID of the webhook that was triggered



22
23
24
# File 'lib/late-sdk/models/webhook_log.rb', line 22

def webhook_id
  @webhook_id
end

#webhook_nameObject

Name of the webhook that was triggered



25
26
27
# File 'lib/late-sdk/models/webhook_log.rb', line 25

def webhook_name
  @webhook_name
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



95
96
97
# File 'lib/late-sdk/models/webhook_log.rb', line 95

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



100
101
102
# File 'lib/late-sdk/models/webhook_log.rb', line 100

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/late-sdk/models/webhook_log.rb', line 76

def self.attribute_map
  {
    :'_id' => :'_id',
    :'webhook_id' => :'webhookId',
    :'webhook_name' => :'webhookName',
    :'event' => :'event',
    :'url' => :'url',
    :'status' => :'status',
    :'status_code' => :'statusCode',
    :'request_payload' => :'requestPayload',
    :'response_body' => :'responseBody',
    :'error_message' => :'errorMessage',
    :'attempt_number' => :'attemptNumber',
    :'response_time' => :'responseTime',
    :'created_at' => :'createdAt'
  }
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



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/late-sdk/models/webhook_log.rb', line 272

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif 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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



124
125
126
127
# File 'lib/late-sdk/models/webhook_log.rb', line 124

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

.openapi_typesObject

Attribute type mapping.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/late-sdk/models/webhook_log.rb', line 105

def self.openapi_types
  {
    :'_id' => :'String',
    :'webhook_id' => :'String',
    :'webhook_name' => :'String',
    :'event' => :'String',
    :'url' => :'String',
    :'status' => :'String',
    :'status_code' => :'Integer',
    :'request_payload' => :'Object',
    :'response_body' => :'String',
    :'error_message' => :'String',
    :'attempt_number' => :'Integer',
    :'response_time' => :'Integer',
    :'created_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/late-sdk/models/webhook_log.rb', line 239

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _id == o._id &&
      webhook_id == o.webhook_id &&
      webhook_name == o.webhook_name &&
      event == o.event &&
      url == o.url &&
      status == o.status &&
      status_code == o.status_code &&
      request_payload == o.request_payload &&
      response_body == o.response_body &&
      error_message == o.error_message &&
      attempt_number == o.attempt_number &&
      response_time == o.response_time &&
      created_at == o.created_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


259
260
261
# File 'lib/late-sdk/models/webhook_log.rb', line 259

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



265
266
267
# File 'lib/late-sdk/models/webhook_log.rb', line 265

def hash
  [_id, webhook_id, webhook_name, event, url, status, status_code, request_payload, response_body, error_message, attempt_number, response_time, created_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



200
201
202
203
204
# File 'lib/late-sdk/models/webhook_log.rb', line 200

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/late-sdk/models/webhook_log.rb', line 294

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



208
209
210
211
212
213
214
215
# File 'lib/late-sdk/models/webhook_log.rb', line 208

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  event_validator = EnumAttributeValidator.new('String', ["post.scheduled", "post.published", "post.failed", "post.partial", "post.cancelled", "post.recycled", "account.connected", "account.disconnected", "message.received", "comment.received", "webhook.test"])
  return false unless event_validator.valid?(@event)
  status_validator = EnumAttributeValidator.new('String', ["success", "failed"])
  return false unless status_validator.valid?(@status)
  true
end