Class: SimpleSpark::Endpoints::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_spark/endpoints/account.rb

Overview

Provides access to the /account endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Account

Returns a new instance of Account.



8
9
10
# File 'lib/simple_spark/endpoints/account.rb', line 8

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/simple_spark/endpoints/account.rb', line 6

def client
  @client
end

Instance Method Details

#retrieve(include_values = nil) ⇒ Hash

Get your SparkPost account information, including subscription status and quota usage.

Parameters:

  • include_values (String) (defaults to: nil)

    Additional parts of account details to include. Multiple parts can be specified in a comma separated list. The only valid value is currently usage and by default the usage details are not included.

Returns:

  • (Hash)

    an account information hash object



18
19
20
21
# File 'lib/simple_spark/endpoints/account.rb', line 18

def retrieve(include_values = nil)
  query_params = include_values.nil? ? {} : { include: include_values }
  @client.call(method: :get, path: 'account', query_values: query_params)
end

#update(values = {}) ⇒ results: { message: "Account has been updated" }

Note:

Example: values = {

company_name: "SparkPost",
options: {
  smtp_tracking_default: true
}

}

Update your SparkPost account information and account-level options.

Parameters:

  • values (Hash) (defaults to: {})

    Request Body Attributes company_name [String] company name options [Hash] account-level options

    smtp_tracking_default [Boolean] set to true to turn on SMTP engagement tracking by default
    rest_tracking_default [Boolean] set to false to turn off REST API engagement tracking by default
    transactional_unsub [Boolean] set to true to include List-Unsubscribe header for all transactional messages by default
    transactional_default [Boolean] set to true to send messages as transactional by default
    

Returns:

  • (results: { message: "Account has been updated" })


40
41
42
# File 'lib/simple_spark/endpoints/account.rb', line 40

def update(values = {})
  @client.call(method: :put, path: 'account', body_values: values)
end