class ActiveCampaignWrapper::Configuration

Attributes

api_token[RW]
endpoint_url[RW]

Public Class Methods

new(endpoint_url: nil, api_token: nil) click to toggle source
# 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

Public Instance Methods

delete(*args) click to toggle source
# File lib/active_campaign_wrapper/configuration.rb, line 40
def delete(*args)
  safe_http_call do
    self.class.delete(*args)
  end
end
get(*args) click to toggle source
# File lib/active_campaign_wrapper/configuration.rb, line 46
def get(*args)
  safe_http_call do
    self.class.get(*args)
  end
end
patch(*args) click to toggle source
# File lib/active_campaign_wrapper/configuration.rb, line 28
def patch(*args)
  safe_http_call do
    self.class.patch(*args)
  end
end
post(*args) click to toggle source
# File lib/active_campaign_wrapper/configuration.rb, line 22
def post(*args)
  safe_http_call do
    self.class.post(*args)
  end
end
put(*args) click to toggle source
# File lib/active_campaign_wrapper/configuration.rb, line 34
def put(*args)
  safe_http_call do
    self.class.put(*args)
  end
end

Private Instance Methods

safe_http_call() { || ... } click to toggle source
# File lib/active_campaign_wrapper/configuration.rb, line 54
def safe_http_call
  response = yield
  normalize_response(response)
end