Class: ZohoInvoice::Client
- Inherits:
-
Object
- Object
- ZohoInvoice::Client
- Includes:
- Configurable
- Defined in:
- lib/zoho_invoice/client.rb
Constant Summary collapse
- RESOURCES =
[ :customers, :invoices ]
Instance Attribute Summary
Attributes included from Configurable
#apikey, #authtoken, #client_options, #scope
Instance Method Summary collapse
- #get(path, params = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #post(path, params = {}) ⇒ Object
- #request(verb, path, params = {}) ⇒ Object
Methods included from Configurable
#config_hash, #configure, keys
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 |
# File 'lib/zoho_invoice/client.rb', line 16 def initialize( = {}) ZohoInvoice::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", [key] || ZohoInvoice.instance_variable_get(:"@#{key}")) end @client_options = ZohoInvoice.instance_variable_get(:'@client_options').merge([:client_options] || {}) end |
Instance Method Details
#get(path, params = {}) ⇒ Object
23 24 25 |
# File 'lib/zoho_invoice/client.rb', line 23 def get(path, params={}) request(:get, path, credentials.merge(params)) end |
#post(path, params = {}) ⇒ Object
27 28 29 |
# File 'lib/zoho_invoice/client.rb', line 27 def post(path, params={}) request(:post, path, credentials.merge(params)) end |
#request(verb, path, params = {}) ⇒ Object
31 32 33 |
# File 'lib/zoho_invoice/client.rb', line 31 def request(verb, path, params={}) connection.send(verb, path, params) end |