Class: ActiveCampaign::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
20
21
# File 'lib/active_campaign/configuration.rb', line 12

def initialize
  @api_key = nil
  @api_endpoint = API_ENDPOINT
  @api_output = API_OUTPUT
  @user_agent = USER_AGENT
  @log = false
  @logger = nil
  @log_level = :info
  @debug = false
end

Instance Attribute Details

#api_endpointObject

Returns the value of attribute api_endpoint.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def api_endpoint
  @api_endpoint
end

#api_keyObject

Returns the value of attribute api_key.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def api_key
  @api_key
end

#api_outputObject

Returns the value of attribute api_output.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def api_output
  @api_output
end

#debugObject

Returns the value of attribute debug.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def debug
  @debug
end

#logObject

Returns the value of attribute log.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def log
  @log
end

#log_levelObject

Returns the value of attribute log_level.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def log_level
  @log_level
end

#loggerObject

Returns the value of attribute logger.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def logger
  @logger
end

#mashObject

Returns the value of attribute mash.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def mash
  @mash
end

#user_agentObject

Returns the value of attribute user_agent.



9
10
11
# File 'lib/active_campaign/configuration.rb', line 9

def user_agent
  @user_agent
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



43
44
45
46
47
48
49
# File 'lib/active_campaign/configuration.rb', line 43

def ==(other)
  other.is_a?(ActiveCampaign::Configuration) &&
    all_api_info_equal &&
    user_agent == other.user_agent &&
    all_log_info_equal &&
    debug == other.debug
end

#hashObject



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

def hash
  [
    api_key,
    api_endpoint,
    api_output,
    user_agent,
    log,
    logger,
    log_level,
    debug,
    ActiveCampaign::Configuration
  ].hash
end

#merge(other_config = {}) ⇒ Object



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

def merge(other_config = {})
  other_config.to_h.each do |k, v|
    send("#{k}=", v) if respond_to?(k)
  end
  self
end

#to_hObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/active_campaign/configuration.rb', line 23

def to_h
  {
    api_key: api_key,
    api_endpoint: api_endpoint,
    api_output: api_output,
    user_agent: user_agent,
    log: log,
    logger: logger,
    log_level: log_level,
    debug: debug
  }
end