Class: Whatsapp::BusinessPhoneNumber::Response
- Inherits:
-
Object
- Object
- Whatsapp::BusinessPhoneNumber::Response
- Defined in:
- lib/ruby/whatsapp/business_phone_number/response.rb
Overview
The response shared by all four phone-number actions: {success}, with an
optional id that only VerifyCode ever populates. One class covers all of
them — unlike SubscribedApp's Response::* namespace — since
Register, Deregister, RequestCode, and VerifyCode all return this same
shape, id included or not.
Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/business-phone-numbers/registration
Instance Attribute Summary collapse
-
#id ⇒ String?
The phone number ID, only ever present on VerifyCode's response.
-
#success ⇒ Boolean
Whether the action succeeded.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(success: false, id: nil) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(success: false, id: nil) ⇒ Response
Returns a new instance of Response.
23 24 25 26 |
# File 'lib/ruby/whatsapp/business_phone_number/response.rb', line 23 def initialize(success: false, id: nil) @success = success @id = id end |
Instance Attribute Details
#id ⇒ String?
Returns The phone number ID, only ever present on VerifyCode's response.
19 20 21 |
# File 'lib/ruby/whatsapp/business_phone_number/response.rb', line 19 def id @id end |
#success ⇒ Boolean
Returns Whether the action succeeded.
14 15 16 |
# File 'lib/ruby/whatsapp/business_phone_number/response.rb', line 14 def success @success end |
Class Method Details
.deserialize(response) ⇒ Response
31 32 33 34 35 |
# File 'lib/ruby/whatsapp/business_phone_number/response.rb', line 31 def deserialize(response) response ||= {} new(success: response["success"] == true, id: response["id"]) end |