Class: Referly::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(key, secret) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/referly/client.rb', line 9

def initialize(key, secret)
  @auth = { username: key, password: secret }
end

Instance Method Details

#accountsObject



21
22
23
# File 'lib/referly/client.rb', line 21

def accounts
  Referly::AccountProxy.new(self)
end

#get(path, params) ⇒ Object



17
18
19
# File 'lib/referly/client.rb', line 17

def get(path, params)
  self.class.get(path, query: params, basic_auth: @auth)
end


25
26
27
# File 'lib/referly/client.rb', line 25

def links
  Referly::LinkProxy.new(self)
end

#post(path, params) ⇒ Object



13
14
15
# File 'lib/referly/client.rb', line 13

def post(path, params)
  self.class.post(path, body: params, basic_auth: @auth)
end

#rewardsObject



29
30
31
# File 'lib/referly/client.rb', line 29

def rewards
  Referly::RewardProxy.new(self)
end