Class: Fountain::Papi::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/fountain/papi/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



8
9
10
11
12
13
14
# File 'lib/fountain/papi/config.rb', line 8

def initialize
  @api_key = nil    # Partner API Key
  @partner_id = nil # Parter Identifier
  @sandbox = true   # Default to sandbox
  @version = 1      # API version
  @base_domain = "https://partners-sandbox.fountain.com" # Default to sandbox base domain
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



6
7
8
# File 'lib/fountain/papi/config.rb', line 6

def api_key
  @api_key
end

#base_domainObject

Returns the value of attribute base_domain.



6
7
8
# File 'lib/fountain/papi/config.rb', line 6

def base_domain
  @base_domain
end

#partner_idObject

Returns the value of attribute partner_id.



6
7
8
# File 'lib/fountain/papi/config.rb', line 6

def partner_id
  @partner_id
end

#sandboxObject

Returns the value of attribute sandbox.



6
7
8
# File 'lib/fountain/papi/config.rb', line 6

def sandbox
  @sandbox
end

#versionObject

Returns the value of attribute version.



6
7
8
# File 'lib/fountain/papi/config.rb', line 6

def version
  @version
end

Instance Method Details

#base_uri(override_partner_id: nil) ⇒ Object



16
17
18
# File 'lib/fountain/papi/config.rb', line 16

def base_uri(override_partner_id: nil)
  "#{base_domain}/v#{version}/partners/#{override_partner_id || partner_id}"
end

#headersObject



20
21
22
23
24
25
# File 'lib/fountain/papi/config.rb', line 20

def headers
  {
    "Content-Type" => "application/json",
    "X-ACCESS-TOKEN" => api_key
  }
end