Class: Payrix::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



8
9
10
11
12
13
# File 'lib/payrix/configuration.rb', line 8

def initialize
  @url = 'https://api.payrix.com'
  @api_key = ''
  @session_key = ''
  @exception_enabled = true
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



6
7
8
# File 'lib/payrix/configuration.rb', line 6

def api_key
  @api_key
end

#exception_enabledObject

Returns the value of attribute exception_enabled.



6
7
8
# File 'lib/payrix/configuration.rb', line 6

def exception_enabled
  @exception_enabled
end

#session_keyObject

Returns the value of attribute session_key.



6
7
8
# File 'lib/payrix/configuration.rb', line 6

def session_key
  @session_key
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/payrix/configuration.rb', line 5

def url
  @url
end

Instance Method Details

#set_test_mode(test) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/payrix/configuration.rb', line 19

def set_test_mode(test)
  host = URI.parse(url).host

  if test == true
    if !host.start_with?('test-')
      @url = "https://test-#{host}"
    end
  else
    if host.start_with?('test-')
      @url = "https://#{host[5..-1]}"
    end
  end
end