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) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key) ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 22 |
# File 'lib/button/client.rb', line 16 def initialize(api_key) if api_key.nil? || api_key.empty? raise ButtonClientError, 'Must provide a Button API key. Find yours at https://app.usebutton.com/settings/organization' end @orders = Orders.new(api_key) end |
Instance Attribute Details
#orders ⇒ Object (readonly)
Returns the value of attribute orders.
24 25 26 |
# File 'lib/button/client.rb', line 24 def orders @orders end |