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.



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

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

Instance Method Details

#accountsObject



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

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

#get(path, params) ⇒ Object



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

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


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

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

#post(path, params) ⇒ Object



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

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

#rewardsObject



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

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