module Twizo::Verification

Attributes

params[R]

Getter for params

Public Instance Methods

send() click to toggle source

Send message to the server and return response

@return [Object]

# 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) click to toggle source

@param [String] recipient

# 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) click to toggle source

@param [String] token

@return [Object]

# File lib/twizo/modules/verification.rb, line 54
def verify(message_id, token)
  response = send_api_call(Entity::ACTION_RETRIEVE, "#{location}/#{message_id}?token=#{token}")

  raise response if response.kind_of?(TwizoError)

  response_to_array(response)
end

Private Instance Methods

location() click to toggle source

@return [String]

# File lib/twizo/modules/verification.rb, line 67
def location
  'verification/submit'
end