Class: ActiveCampaignWrapper::Configuration

Inherits:
Object
  • Object
show all
Includes:
Helpers, HTTParty
Defined in:
lib/active_campaign_wrapper/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

handle_errors, normalize_body, normalize_response, transform_array, transform_key, transform_keys, transform_value

Constructor Details

#initialize(endpoint_url: nil, api_token: nil) ⇒ Configuration

Returns a new instance of Configuration.



14
15
16
17
18
19
20
# File 'lib/active_campaign_wrapper/configuration.rb', line 14

def initialize(endpoint_url: nil, api_token: nil)
  @endpoint_url = endpoint_url.presence || ActiveCampaignWrapper.endpoint_url
  @api_token = api_token.presence || ActiveCampaignWrapper.api_token

  self.class.base_uri "#{@endpoint_url}/api/#{ActiveCampaignWrapper::API_VERSION}"
  self.class.default_options.merge! headers: { 'Api-Token' => @api_token }
end

Instance Attribute Details

#api_tokenObject

Returns the value of attribute api_token.



10
11
12
# File 'lib/active_campaign_wrapper/configuration.rb', line 10

def api_token
  @api_token
end

#endpoint_urlObject

Returns the value of attribute endpoint_url.



10
11
12
# File 'lib/active_campaign_wrapper/configuration.rb', line 10

def endpoint_url
  @endpoint_url
end

Instance Method Details

#delete(*args) ⇒ Object



40
41
42
43
44
# File 'lib/active_campaign_wrapper/configuration.rb', line 40

def delete(*args)
  safe_http_call do
    self.class.delete(*args)
  end
end

#get(*args) ⇒ Object



46
47
48
49
50
# File 'lib/active_campaign_wrapper/configuration.rb', line 46

def get(*args)
  safe_http_call do
    self.class.get(*args)
  end
end

#patch(*args) ⇒ Object



28
29
30
31
32
# File 'lib/active_campaign_wrapper/configuration.rb', line 28

def patch(*args)
  safe_http_call do
    self.class.patch(*args)
  end
end

#post(*args) ⇒ Object



22
23
24
25
26
# File 'lib/active_campaign_wrapper/configuration.rb', line 22

def post(*args)
  safe_http_call do
    self.class.post(*args)
  end
end

#put(*args) ⇒ Object



34
35
36
37
38
# File 'lib/active_campaign_wrapper/configuration.rb', line 34

def put(*args)
  safe_http_call do
    self.class.put(*args)
  end
end