Class: Tendril::Client
- Inherits:
-
Object
- Object
- Tendril::Client
- Includes:
- HTTParty
- Defined in:
- lib/tendril/client.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#subdomain ⇒ Object
readonly
Returns the value of attribute subdomain.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #meter(secondary, options = {}) ⇒ Object
- #pricing(secondary, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/tendril/client.rb', line 8 def initialize(={}) @subdomain = [:subdomain] || Tendril.subdomain @email = [:email] || Tendril.email @password = [:password] || Tendril.password @account_id = [:account_id] || Tendril.account_id self.class.base_uri "https://#{@subdomain}.tendrildemo.com/api/rest" self.class.headers 'Accept' => 'application/json', 'Emsauthtoken' => "#{@email}:#{@password}" end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
6 7 8 |
# File 'lib/tendril/client.rb', line 6 def account_id @account_id end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
6 7 8 |
# File 'lib/tendril/client.rb', line 6 def email @email end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/tendril/client.rb', line 6 def password @password end |
#subdomain ⇒ Object (readonly)
Returns the value of attribute subdomain.
6 7 8 |
# File 'lib/tendril/client.rb', line 6 def subdomain @subdomain end |
Instance Method Details
#meter(secondary, options = {}) ⇒ Object
23 24 25 |
# File 'lib/tendril/client.rb', line 23 def meter(secondary, ={}) mashup(self.class.get("/meter/#{secondary}#{hash_to_querystring()}")) end |
#pricing(secondary, options = {}) ⇒ Object
19 20 21 |
# File 'lib/tendril/client.rb', line 19 def pricing(secondary, ={}) mashup(self.class.get("/pricing/#{secondary}#{hash_to_querystring()}")) end |