Class: Sendly::WhatsAppSignupSession
- Inherits:
-
Object
- Object
- Sendly::WhatsAppSignupSession
- Defined in:
- lib/sendly/whatsapp_resource.rb
Overview
A newly started WhatsApp signup. Hand connect_url to a human — they
open it in a browser and log in with Facebook to link their WhatsApp
Business Account. Poll Sendly::WhatsAppSignupResource#get with id until the
status is "active".
Constant Summary collapse
- STATUSES =
%w[initiated registering active failed expired].freeze
Instance Attribute Summary collapse
-
#connect_url ⇒ Object
readonly
Returns the value of attribute connect_url.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(data) ⇒ WhatsAppSignupSession
constructor
A new instance of WhatsAppSignupSession.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ WhatsAppSignupSession
Returns a new instance of WhatsAppSignupSession.
13 14 15 16 17 |
# File 'lib/sendly/whatsapp_resource.rb', line 13 def initialize(data) @id = data["id"] @connect_url = data["connectUrl"] || data["connect_url"] @status = data["status"] end |
Instance Attribute Details
#connect_url ⇒ Object (readonly)
Returns the value of attribute connect_url.
9 10 11 |
# File 'lib/sendly/whatsapp_resource.rb', line 9 def connect_url @connect_url end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/sendly/whatsapp_resource.rb', line 9 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
9 10 11 |
# File 'lib/sendly/whatsapp_resource.rb', line 9 def status @status end |
Instance Method Details
#active? ⇒ Boolean
19 20 21 |
# File 'lib/sendly/whatsapp_resource.rb', line 19 def active? status == "active" end |
#failed? ⇒ Boolean
23 24 25 |
# File 'lib/sendly/whatsapp_resource.rb', line 23 def failed? status == "failed" end |
#to_h ⇒ Object
27 28 29 |
# File 'lib/sendly/whatsapp_resource.rb', line 27 def to_h { id: id, connect_url: connect_url, status: status }.compact end |