Class: Recomiendo::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/recomiendo/client.rb

Instance Method Summary collapse

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

#accountsObject



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


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

#rewardsObject



39
40
41
# File 'lib/recomiendo/client.rb', line 39

def rewards
  Recomiendo::Reward.new(self)
end