Class: Sendly::WhatsAppSignup
- Inherits:
-
Object
- Object
- Sendly::WhatsAppSignup
- Defined in:
- lib/sendly/whatsapp_resource.rb
Overview
The status of a WhatsApp signup. business_account_id is nil until the
human completes the connect step; failure_reasons is set when the
status is "failed".
Constant Summary collapse
- STATUSES =
%w[initiated registering active failed expired].freeze
Instance Attribute Summary collapse
-
#business_account_id ⇒ Object
readonly
Returns the value of attribute business_account_id.
-
#failure_reasons ⇒ Object
readonly
Returns the value of attribute failure_reasons.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#phone_number ⇒ Object
readonly
Returns the value of attribute phone_number.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #expired? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(data) ⇒ WhatsAppSignup
constructor
A new instance of WhatsAppSignup.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ WhatsAppSignup
Returns a new instance of WhatsAppSignup.
41 42 43 44 45 46 47 48 |
# File 'lib/sendly/whatsapp_resource.rb', line 41 def initialize(data) @id = data["id"] @status = data["status"] @phone_number = data["phoneNumber"] || data["phone_number"] @business_account_id = data["businessAccountId"] || data["business_account_id"] @failure_reasons = data["failureReasons"] || data["failure_reasons"] @updated_at = data["updatedAt"] || data["updated_at"] end |
Instance Attribute Details
#business_account_id ⇒ Object (readonly)
Returns the value of attribute business_account_id.
36 37 38 |
# File 'lib/sendly/whatsapp_resource.rb', line 36 def business_account_id @business_account_id end |
#failure_reasons ⇒ Object (readonly)
Returns the value of attribute failure_reasons.
36 37 38 |
# File 'lib/sendly/whatsapp_resource.rb', line 36 def failure_reasons @failure_reasons end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
36 37 38 |
# File 'lib/sendly/whatsapp_resource.rb', line 36 def id @id end |
#phone_number ⇒ Object (readonly)
Returns the value of attribute phone_number.
36 37 38 |
# File 'lib/sendly/whatsapp_resource.rb', line 36 def phone_number @phone_number end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
36 37 38 |
# File 'lib/sendly/whatsapp_resource.rb', line 36 def status @status end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
36 37 38 |
# File 'lib/sendly/whatsapp_resource.rb', line 36 def updated_at @updated_at end |
Instance Method Details
#active? ⇒ Boolean
50 51 52 |
# File 'lib/sendly/whatsapp_resource.rb', line 50 def active? status == "active" end |
#expired? ⇒ Boolean
58 59 60 |
# File 'lib/sendly/whatsapp_resource.rb', line 58 def expired? status == "expired" end |
#failed? ⇒ Boolean
54 55 56 |
# File 'lib/sendly/whatsapp_resource.rb', line 54 def failed? status == "failed" end |
#to_h ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/sendly/whatsapp_resource.rb', line 62 def to_h { id: id, status: status, phone_number: phone_number, business_account_id: business_account_id, failure_reasons: failure_reasons, updated_at: updated_at }.compact end |