Class: Freemle::Client
- Inherits:
-
Object
- Object
- Freemle::Client
- Defined in:
- lib/freemle/client.rb,
lib/freemle/client/version.rb,
lib/freemle/client/resource.rb
Defined Under Namespace
Classes: Resource
Constant Summary collapse
- BASE_URL =
'https://www.freemle.com/api'
- VERSION =
'1.0.1'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#customers ⇒ Freemle::Client::Resource
Access the customer resource.
-
#initialize(opts) ⇒ Freemle::Client
constructor
Initialize a Freemle client.
-
#invoices ⇒ Freemle::Client::Resource
Access the invoice resource.
Constructor Details
#initialize(opts) ⇒ Freemle::Client
Initialize a Freemle client.
24 25 26 27 28 |
# File 'lib/freemle/client.rb', line 24 def initialize(opts) self.base_url = opts.fetch(:base_url, BASE_URL) self.app_name = opts.fetch(:app_name) self.api_key = opts.fetch(:api_key) end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/freemle/client.rb', line 8 def api_key @api_key end |
#app_name ⇒ Object
Returns the value of attribute app_name.
8 9 10 |
# File 'lib/freemle/client.rb', line 8 def app_name @app_name end |
#base_url ⇒ Object
Returns the value of attribute base_url.
8 9 10 |
# File 'lib/freemle/client.rb', line 8 def base_url @base_url end |
Instance Method Details
#customers ⇒ Freemle::Client::Resource
Access the customer resource.
38 39 40 |
# File 'lib/freemle/client.rb', line 38 def customers @customers ||= new_resource(self, :customer, :customers) end |
#invoices ⇒ Freemle::Client::Resource
Access the invoice resource.
50 51 52 |
# File 'lib/freemle/client.rb', line 50 def invoices @invoices ||= new_resource(self, :invoice, :invoices) end |