Class: ActiveCampaign::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/active_campaign/configuration.rb

Overview

Class Configuration provides configuration of ActiveCampaign

Author:

Constant Summary collapse

API_URL =
'https://account.api-us1.com/api/3'
API_TOKEN =
'ACCOUNT_TOKEN'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



52
53
54
55
56
57
58
59
60
61
# File 'lib/active_campaign/configuration.rb', line 52

def initialize
  self.adapter         = :net_http
  self.api_url         = API_URL
  self.api_timeout     = 5
  self.api_token       = API_TOKEN
  self.debug           = false
  self.logger          = Logger.new(STDOUT)
  @request_middleware  = {}
  @response_middleware = {}
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



16
17
18
# File 'lib/active_campaign/configuration.rb', line 16

def adapter
  @adapter
end

#api_timeoutObject

Returns the value of attribute api_timeout.



34
35
36
# File 'lib/active_campaign/configuration.rb', line 34

def api_timeout
  @api_timeout
end

#api_tokenObject

Returns the value of attribute api_token.



39
40
41
# File 'lib/active_campaign/configuration.rb', line 39

def api_token
  @api_token
end

#api_urlObject

Returns the value of attribute api_url.



29
30
31
# File 'lib/active_campaign/configuration.rb', line 29

def api_url
  @api_url
end

#debugObject Also known as: debug?

Returns the value of attribute debug.



44
45
46
# File 'lib/active_campaign/configuration.rb', line 44

def debug
  @debug
end

#loggerObject

Returns the value of attribute logger.



50
51
52
# File 'lib/active_campaign/configuration.rb', line 50

def logger
  @logger
end

#request_middlewareObject (readonly)

Returns the value of attribute request_middleware.



20
21
22
# File 'lib/active_campaign/configuration.rb', line 20

def request_middleware
  @request_middleware
end

#response_middlewareObject (readonly)

Returns the value of attribute response_middleware.



24
25
26
# File 'lib/active_campaign/configuration.rb', line 24

def response_middleware
  @response_middleware
end

Instance Method Details

#to_hObject



103
104
105
106
107
108
109
110
111
112
# File 'lib/active_campaign/configuration.rb', line 103

def to_h
  {
    adapter: adapter,
    api_url: api_url,
    api_timeout: api_timeout,
    api_token: api_token,
    request_middleware: request_middleware,
    response_middleware: response_middleware
  }
end