class SimpleSpark::Endpoints::Subaccounts
Provides access to the /subaccounts endpoint @note Example subaccount @note See: developers.sparkpost.com/api/#/reference/subaccounts
Attributes
Public Class Methods
# File lib/simple_spark/endpoints/subaccounts.rb, line 9 def initialize(client) @client = client end
Public Instance Methods
Create a subaccount @param values [Hash] the values to create the subaccount with @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 See: developers.sparkpost.com/api/#/reference/subaccounts/subaccounts-collection/create-new-subaccount
# File lib/simple_spark/endpoints/subaccounts.rb, line 29 def create(values) @client.call(method: :post, path: 'subaccounts', body_values: values) end
List subaccounts @return [Array] a list of Subaccount hash objects @note See: developers.sparkpost.com/api/#/reference/subaccounts/subaccounts-collection/list-subaccounts
# File lib/simple_spark/endpoints/subaccounts.rb, line 16 def list @client.call(method: :get, path: 'subaccounts') end
Retrieve details about a subaccount by specifying its id @param id [Integer] the ID of the subaccount @return [Hash] an Subaccount hash object @note See: developers.sparkpost.com/api/#/reference/subaccounts/subaccounts-entity/list-specific-subaccount
# File lib/simple_spark/endpoints/subaccounts.rb, line 37 def retrieve(id) @client.call(method: :get, path: "subaccounts/#{id}") end
Update a Subaccount by its ID @param id [Integer] the ID of the subaccount @param values [Hash] the values to update the subaccount with @note See: developers.sparkpost.com/api/#/reference/subaccounts/subaccounts-entity/edit-a-subaccount
# File lib/simple_spark/endpoints/subaccounts.rb, line 45 def update(id, values) @client.call(method: :put, path: "subaccounts/#{id}", body_values: values) end