Class: Recomiendo::Client
- Inherits:
-
Object
- Object
- Recomiendo::Client
- Includes:
- HTTParty
- Defined in:
- lib/recomiendo/client.rb
Instance Method Summary collapse
- #accounts ⇒ Object
- #delete(path) ⇒ Object
- #get(path, params) ⇒ Object
-
#initialize(key, secret) ⇒ Client
constructor
A new instance of Client.
- #links ⇒ Object
- #post(path, params) ⇒ Object
- #put(path, params) ⇒ Object
- #rewards ⇒ Object
Constructor Details
#initialize(key, secret) ⇒ Client
Returns a new instance of Client.
11 12 13 |
# File 'lib/recomiendo/client.rb', line 11 def initialize(key, secret) @auth = { username: key, password: secret } end |
Instance Method Details
#accounts ⇒ Object
31 32 33 |
# File 'lib/recomiendo/client.rb', line 31 def accounts Recomiendo::Account.new(self) end |
#delete(path) ⇒ Object
23 24 25 |
# File 'lib/recomiendo/client.rb', line 23 def delete(path) self.class.delete(path, basic_auth: @auth) end |
#get(path, params) ⇒ Object
19 20 21 |
# File 'lib/recomiendo/client.rb', line 19 def get(path, params) self.class.get(path, query: params, basic_auth: @auth) end |
#links ⇒ Object
35 36 37 |
# File 'lib/recomiendo/client.rb', line 35 def links Recomiendo::Link.new(self) end |
#post(path, params) ⇒ Object
15 16 17 |
# File 'lib/recomiendo/client.rb', line 15 def post(path, params) self.class.post(path, body: params, basic_auth: @auth) end |
#put(path, params) ⇒ Object
27 28 29 |
# File 'lib/recomiendo/client.rb', line 27 def put(path, params) self.class.put(path, body: params, basic_auth: @auth) end |
#rewards ⇒ Object
39 40 41 |
# File 'lib/recomiendo/client.rb', line 39 def rewards Recomiendo::Reward.new(self) end |