Class: Walinko::MessageStatus
- Inherits:
-
Object
- Object
- Walinko::MessageStatus
- Defined in:
- lib/walinko/result.rb
Overview
Returned by ‘client.messages.fetch(tracking_id)`. Wraps the `data` block of `GET /messages/:trackingId`.
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#device_id ⇒ Object
readonly
Returns the value of attribute device_id.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#sent_at ⇒ Object
readonly
Returns the value of attribute sent_at.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#template_id ⇒ Object
readonly
Returns the value of attribute template_id.
-
#tracking_id ⇒ Object
readonly
Returns the value of attribute tracking_id.
-
#variant_index ⇒ Object
readonly
Returns the value of attribute variant_index.
-
#wa_message_id ⇒ Object
readonly
Returns the value of attribute wa_message_id.
Instance Method Summary collapse
- #done? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(data:, request_id:) ⇒ MessageStatus
constructor
A new instance of MessageStatus.
- #pending? ⇒ Boolean
- #sent? ⇒ Boolean
Constructor Details
#initialize(data:, request_id:) ⇒ MessageStatus
Returns a new instance of MessageStatus.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/walinko/result.rb', line 71 def initialize(data:, request_id:) @tracking_id = data['tracking_id'] @status = data['status'] @device_id = data['device_id'] @template_id = data['template_id'] @variant_index = data['variant_index'] @phone = data['phone'] @wa_message_id = data['wa_message_id'] @error_code = data['error_code'] @error_message = data['error_message'] @sent_at = parse_time(data['sent_at']) @created_at = parse_time(data['created_at']) @request_id = request_id end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def created_at @created_at end |
#device_id ⇒ Object (readonly)
Returns the value of attribute device_id.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def device_id @device_id end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def error_code @error_code end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def @error_message end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def phone @phone end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def request_id @request_id end |
#sent_at ⇒ Object (readonly)
Returns the value of attribute sent_at.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def sent_at @sent_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def status @status end |
#template_id ⇒ Object (readonly)
Returns the value of attribute template_id.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def template_id @template_id end |
#tracking_id ⇒ Object (readonly)
Returns the value of attribute tracking_id.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def tracking_id @tracking_id end |
#variant_index ⇒ Object (readonly)
Returns the value of attribute variant_index.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def variant_index @variant_index end |
#wa_message_id ⇒ Object (readonly)
Returns the value of attribute wa_message_id.
65 66 67 |
# File 'lib/walinko/result.rb', line 65 def @wa_message_id end |
Instance Method Details
#done? ⇒ Boolean
89 |
# File 'lib/walinko/result.rb', line 89 def done?; sent? || failed?; end |
#failed? ⇒ Boolean
87 |
# File 'lib/walinko/result.rb', line 87 def failed?; status == 'failed'; end |
#pending? ⇒ Boolean
88 |
# File 'lib/walinko/result.rb', line 88 def pending?; %w[queued sending].include?(status); end |
#sent? ⇒ Boolean
86 |
# File 'lib/walinko/result.rb', line 86 def sent?; status == 'sent'; end |