Class: Button::Client
- Inherits:
-
Object
- Object
- Button::Client
- Defined in:
- lib/button/client.rb
Overview
Client is the top-level interface for the Button API. It exposes one resource currently: ‘.orders`. It requires a valid API key to make requests on behalf of your organization, which can be found at app.usebutton.com/settings/organization.
## Usage
client = Button::Client.new(“sk-XXX”) puts client.orders.get(“btnorder-XXX”)
Instance Attribute Summary collapse
-
#orders ⇒ Object
readonly
Returns the value of attribute orders.
Instance Method Summary collapse
-
#initialize(api_key, config = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key, config = {}) ⇒ Client
Returns a new instance of Client.
19 20 21 22 23 24 25 26 27 |
# File 'lib/button/client.rb', line 19 def initialize(api_key, config = {}) if api_key.nil? || api_key.empty? raise ButtonClientError, NO_API_KEY_MESSAGE end config_with_defaults = merge_defaults(config) @orders = Orders.new(api_key, config_with_defaults) end |
Instance Attribute Details
#orders ⇒ Object (readonly)
Returns the value of attribute orders.
40 41 42 |
# File 'lib/button/client.rb', line 40 def orders @orders end |