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.



5
6
7
8
9
10
11
12
13
14
15
16
17
# 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

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


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

Instance Attribute Details

#transmissionObject (readonly)

Returns the value of attribute transmission.



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

def transmission
  @transmission
end