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



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.



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.



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