Module: Twizo::Verification
- Defined in:
- lib/twizo/modules/verification.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Getter for params.
Instance Method Summary collapse
-
#send ⇒ Object
Send message to the server and return response.
- #set(recipient) ⇒ Object
- #verify(message_id, token) ⇒ Object
Instance Attribute Details
#params ⇒ Object (readonly)
Getter for params
21 22 23 |
# File 'lib/twizo/modules/verification.rb', line 21 def params @params end |
Instance Method Details
#send ⇒ Object
Send message to the server and return response
39 40 41 42 43 44 45 46 47 |
# File 'lib/twizo/modules/verification.rb', line 39 def send post_params = @params.to_json response = send_api_call(Entity::ACTION_CREATE, location, post_params) raise response if response.kind_of?(TwizoError) response_to_array(response) end |
#set(recipient) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/twizo/modules/verification.rb', line 26 def set(recipient) @params = VerificationParams.new @params.recipient = recipient # set default type @params.type ||= 'sms' end |
#verify(message_id, token) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/twizo/modules/verification.rb', line 54 def verify(, token) response = send_api_call(Entity::ACTION_RETRIEVE, "#{location}/#{}?token=#{token}") raise response if response.kind_of?(TwizoError) response_to_array(response) end |