Class: Yoolinkpro::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/yoolinkpro/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(public_key = Yoolinkpro.public_key, private_key = Yoolinkpro.private_key, admin_key = Yoolinkpro.admin_key) ⇒ Yoolinkpro::Client

Yoolinkpro::Client

client = Yoolinkpro::Client.new 'public_key', 'private_key', 'admin_key'

Parameters:

  • public_key (String) (defaults to: Yoolinkpro.public_key)
  • private_key (String) (defaults to: Yoolinkpro.private_key)
  • admin_key (String) (defaults to: Yoolinkpro.admin_key)


14
15
16
# File 'lib/yoolinkpro/client.rb', line 14

def initialize(public_key = Yoolinkpro.public_key, private_key = Yoolinkpro.private_key, admin_key = Yoolinkpro.admin_key)
  @public_key, @private_key, @admin_key = public_key, private_key, admin_key
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/yoolinkpro/client.rb', line 18

def method_missing(method, *args)
  api = Api.new(self)
  response = api.send(method, *args)
  Oj.load(response.body, :symbol_keys => true)
rescue RestClient::Exception => ex
  raise ApiException, ex.message
end

Instance Attribute Details

#admin_keyObject (readonly)

Returns the value of attribute admin_key.



4
5
6
# File 'lib/yoolinkpro/client.rb', line 4

def admin_key
  @admin_key
end

#private_keyObject (readonly)

Returns the value of attribute private_key.



4
5
6
# File 'lib/yoolinkpro/client.rb', line 4

def private_key
  @private_key
end

#public_keyObject (readonly)

Returns the value of attribute public_key.



4
5
6
# File 'lib/yoolinkpro/client.rb', line 4

def public_key
  @public_key
end