Class: SimpleSpark::Endpoints::Subaccounts
- Inherits:
-
Object
- Object
- SimpleSpark::Endpoints::Subaccounts
- Defined in:
- lib/simple_spark/endpoints/subaccounts.rb
Overview
Note:
Example subaccount
Provides access to the /subaccounts endpoint
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(values) ⇒ Object
Create a subaccount.
-
#initialize(client) ⇒ Subaccounts
constructor
A new instance of Subaccounts.
-
#list ⇒ Array
List subaccounts.
-
#retrieve(id) ⇒ Hash
Retrieve details about a subaccount by specifying its id.
-
#update(id, values) ⇒ Object
Update a Subaccount by its ID.
Constructor Details
#initialize(client) ⇒ Subaccounts
Returns a new instance of Subaccounts.
9 10 11 |
# File 'lib/simple_spark/endpoints/subaccounts.rb', line 9 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/simple_spark/endpoints/subaccounts.rb', line 7 def client @client end |
Instance Method Details
#create(values) ⇒ Object
Note:
Example: values =
"name": "Sparkle Ponies",
"key_label": "API Key for Sparkle Ponies Subaccount",
"key_grants": ["smtp/inject", "sending_domains/manage", "message_events/view", "suppression_lists/manage"]
Note:
Create a subaccount
29 30 31 |
# File 'lib/simple_spark/endpoints/subaccounts.rb', line 29 def create(values) @client.call(method: :post, path: 'subaccounts', body_values: values) end |
#list ⇒ Array
Note:
List subaccounts
16 17 18 |
# File 'lib/simple_spark/endpoints/subaccounts.rb', line 16 def list @client.call(method: :get, path: 'subaccounts') end |
#retrieve(id) ⇒ Hash
Note:
Retrieve details about a subaccount by specifying its id
37 38 39 |
# File 'lib/simple_spark/endpoints/subaccounts.rb', line 37 def retrieve(id) @client.call(method: :get, path: "subaccounts/#{id}") end |
#update(id, values) ⇒ Object
Note:
Update a Subaccount by its ID
45 46 47 |
# File 'lib/simple_spark/endpoints/subaccounts.rb', line 45 def update(id, values) @client.call(method: :put, path: "subaccounts/#{id}", body_values: values) end |