Class: Switchcoder::Client
- Inherits:
-
Object
- Object
- Switchcoder::Client
- Defined in:
- lib/switchcoder/client.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
- #code(id, phone_number = nil, opts = nil) ⇒ Object
-
#initialize(api_token, host = nil, opts = nil) ⇒ Client
constructor
A new instance of Client.
- #phone_number(num, opts = nil) ⇒ Object
Constructor Details
#initialize(api_token, host = nil, opts = nil) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 |
# File 'lib/switchcoder/client.rb', line 7 def initialize(api_token, host = nil, opts = nil) @api_token = api_token; @host = host || 'api.switchcoder.com'; @opts = (opts || {}).inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
5 6 7 |
# File 'lib/switchcoder/client.rb', line 5 def api_token @api_token end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/switchcoder/client.rb', line 5 def host @host end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
5 6 7 |
# File 'lib/switchcoder/client.rb', line 5 def opts @opts end |
Instance Method Details
#code(id, phone_number = nil, opts = nil) ⇒ Object
17 18 19 20 21 |
# File 'lib/switchcoder/client.rb', line 17 def code(id, phone_number = nil, opts = nil) script = Code.new(id, phone_number, opts) script.client = self return script end |
#phone_number(num, opts = nil) ⇒ Object
13 14 15 |
# File 'lib/switchcoder/client.rb', line 13 def phone_number(num,opts = nil) PhoneNumber.new(num, opts) end |