Class: Telein::Client
- Inherits:
-
Object
- Object
- Telein::Client
- Defined in:
- lib/telein/client.rb
Overview
Class used to query Telein servers for carrier codes
No API key given
The client doesn't make any request if the API key is missing, returning a 999 code immediately.
Invalid phones
Telein can tell if a given phone is invalid but each request is a credit spent so the class also encapsulates the code from Telein::Util::Phone to detect invalid ones preemptively.
All servers down
If all Registered servers are down, then the client return 101 for carrier_code
Instance Method Summary collapse
-
#carrier_code_for(value) ⇒ Integer
deprecated
Deprecated.
Use #query for greater functionality.
- #query(value) ⇒ Object
Instance Method Details
#carrier_code_for(value) ⇒ Integer
Deprecated.
Use #query for greater functionality.
Filters the query to the Telein servers so that it only returns the carrier code.
79 80 81 |
# File 'lib/telein/client.rb', line 79 def carrier_code_for(value) return query(value)[:carrier_code] end |
#query(value) ⇒ Object
69 70 71 72 |
# File 'lib/telein/client.rb', line 69 def query(value) carrier_code, number = raw_query(value) return { :carrier_code => carrier_code, :number => number } end |