module Twizo::NumberLookup

Constants

RESULT_TYPE_CALLBACK

Bitmasks of which type of result type to send

RESULT_TYPE_POLL

Attributes

params[R]

Getter for params

Public Instance Methods

poll() click to toggle source

@return [Object]

# File lib/twizo/modules/number_lookup.rb, line 55
def poll
  response = send_api_call(Entity::ACTION_RETRIEVE, 'numberlookup/poll')

  raise response if response.kind_of?(TwizoError)

  batch_id = response['batchId'] unless response['batchId'].nil?

  unless batch_id.nil?
    send_api_call(Entity::ACTION_REMOVE, 'numberlookup/poll/' + batch_id)
  end

  response_to_array(response, 'messages')
end
send() click to toggle source

Send message to the server and return response

@return [Object]

# File lib/twizo/modules/number_lookup.rb, line 42
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, 'items')
end
set(numbers) click to toggle source

@param [Array] numbers

# File lib/twizo/modules/number_lookup.rb, line 32
def set(numbers)
  @params = NumberLookupParams.new
  @params.numbers = numbers
end

Private Instance Methods

location() click to toggle source

@return [String]

# File lib/twizo/modules/number_lookup.rb, line 74
def location
  'numberlookup/submit'
end