Class: SparkPost::Client

Inherits:
Object show all
Defined in:
lib/sparkpost/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil, api_host = 'https://api.sparkpost.com') ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sparkpost/client.rb', line 5

def initialize(api_key = nil, api_host = 'https://api.sparkpost.com')
  @api_key = (api_key || ENV['SPARKPOST_API_KEY']).to_s
  @api_host = (api_host || ENV['SPARKPOST_API_HOST']).to_s

  raise ArgumentError, 'No API key is provided. Either provide
   api_key with constructor or set SPARKPOST_API_KEY environment
    variable' if @api_key.blank?

  raise ArgumentError, 'No API host is provided. Either provide
   api_host with constructor or set SPARKPOST_API_HOST environment
    variable' if @api_host.blank?
end

Instance Attribute Details

#templateObject (readonly)

Returns the value of attribute template.



4
5
6
# File 'lib/sparkpost/client.rb', line 4

def template
  @template
end

#transmissionObject (readonly)

Returns the value of attribute transmission.



3
4
5
# File 'lib/sparkpost/client.rb', line 3

def transmission
  @transmission
end