Module: Twizo::NumberLookup
- Defined in:
- lib/twizo/modules/number_lookup.rb
Constant Summary collapse
- RESULT_TYPE_CALLBACK =
Bitmasks of which type of result type to send
1
- RESULT_TYPE_POLL =
2
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Getter for params.
Instance Method Summary collapse
- #poll ⇒ Object
-
#send ⇒ Object
Send message to the server and return response.
- #set(numbers) ⇒ Object
Instance Attribute Details
#params ⇒ Object (readonly)
Getter for params
21 22 23 |
# File 'lib/twizo/modules/number_lookup.rb', line 21 def params @params end |
Instance Method Details
#poll ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# 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 ⇒ Object
Send message to the server and return response
42 43 44 45 46 47 48 49 50 |
# 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) ⇒ Object
32 33 34 35 |
# File 'lib/twizo/modules/number_lookup.rb', line 32 def set(numbers) @params = NumberLookupParams.new @params.numbers = numbers end |