Class: Sendly::WebhookMessageData

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/webhooks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ WebhookMessageData

Returns a new instance of WebhookMessageData.



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/sendly/webhooks.rb', line 201

def initialize(data)
  @id = data[:id] || data[:message_id] || ''
  @status = data[:status]
  @to = data[:to]
  @from = data[:from] || ''
  @direction = data[:direction] || 'outbound'
  @organization_id = data[:organization_id]
  @text = data[:text]
  @error = data[:error]
  @error_code = data[:error_code]
  @delivered_at = data[:delivered_at]
  @failed_at = data[:failed_at]
  @created_at = data[:created_at]
  @segments = data[:segments] || 1
  @credits_used = data[:credits_used] || 0
  @message_format = data[:message_format]
  @media_urls = data[:media_urls]
  @retry_count = data[:retry_count]
  @metadata = data[:metadata]
  @batch_id = data[:batch_id]
end

Instance Attribute Details

#batch_idObject (readonly)

Returns the value of attribute batch_id.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def batch_id
  @batch_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def created_at
  @created_at
end

#credits_usedObject (readonly)

Returns the value of attribute credits_used.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def credits_used
  @credits_used
end

#delivered_atObject (readonly)

Returns the value of attribute delivered_at.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def delivered_at
  @delivered_at
end

#directionObject (readonly)

Returns the value of attribute direction.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def direction
  @direction
end

#errorObject (readonly)

Returns the value of attribute error.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def error
  @error
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def error_code
  @error_code
end

#failed_atObject (readonly)

Returns the value of attribute failed_at.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def failed_at
  @failed_at
end

#fromObject (readonly)

Returns the value of attribute from.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def from
  @from
end

#idObject (readonly)

Returns the value of attribute id.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def id
  @id
end

#media_urlsObject (readonly)

Returns the value of attribute media_urls.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def media_urls
  @media_urls
end

#message_formatObject (readonly)

Returns the value of attribute message_format.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def message_format
  @message_format
end

#metadataObject (readonly)

Returns the value of attribute metadata.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def 
  @metadata
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def organization_id
  @organization_id
end

#retry_countObject (readonly)

Returns the value of attribute retry_count.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def retry_count
  @retry_count
end

#segmentsObject (readonly)

Returns the value of attribute segments.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def segments
  @segments
end

#statusObject (readonly)

Returns the value of attribute status.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def status
  @status
end

#textObject (readonly)

Returns the value of attribute text.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def text
  @text
end

#toObject (readonly)

Returns the value of attribute to.



196
197
198
# File 'lib/sendly/webhooks.rb', line 196

def to
  @to
end

Instance Method Details

#message_idObject



223
224
225
# File 'lib/sendly/webhooks.rb', line 223

def message_id
  @id
end

#to_hObject



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/sendly/webhooks.rb', line 227

def to_h
  {
    id: @id,
    status: @status,
    to: @to,
    from: @from,
    direction: @direction,
    error: @error,
    error_code: @error_code,
    delivered_at: @delivered_at,
    failed_at: @failed_at,
    segments: @segments,
    credits_used: @credits_used,
    batch_id: @batch_id
  }.compact
end