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.



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/sendly/webhooks.rb', line 185

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.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def batch_id
  @batch_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def created_at
  @created_at
end

#credits_usedObject (readonly)

Returns the value of attribute credits_used.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def credits_used
  @credits_used
end

#delivered_atObject (readonly)

Returns the value of attribute delivered_at.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def delivered_at
  @delivered_at
end

#directionObject (readonly)

Returns the value of attribute direction.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def direction
  @direction
end

#errorObject (readonly)

Returns the value of attribute error.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def error
  @error
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def error_code
  @error_code
end

#failed_atObject (readonly)

Returns the value of attribute failed_at.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def failed_at
  @failed_at
end

#fromObject (readonly)

Returns the value of attribute from.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def from
  @from
end

#idObject (readonly)

Returns the value of attribute id.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def id
  @id
end

#media_urlsObject (readonly)

Returns the value of attribute media_urls.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def media_urls
  @media_urls
end

#message_formatObject (readonly)

Returns the value of attribute message_format.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def message_format
  @message_format
end

#metadataObject (readonly)

Returns the value of attribute metadata.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def 
  @metadata
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def organization_id
  @organization_id
end

#retry_countObject (readonly)

Returns the value of attribute retry_count.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def retry_count
  @retry_count
end

#segmentsObject (readonly)

Returns the value of attribute segments.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def segments
  @segments
end

#statusObject (readonly)

Returns the value of attribute status.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def status
  @status
end

#textObject (readonly)

Returns the value of attribute text.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def text
  @text
end

#toObject (readonly)

Returns the value of attribute to.



180
181
182
# File 'lib/sendly/webhooks.rb', line 180

def to
  @to
end

Instance Method Details

#message_idObject



207
208
209
# File 'lib/sendly/webhooks.rb', line 207

def message_id
  @id
end

#to_hObject



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/sendly/webhooks.rb', line 211

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