Class: Agms::Configuration

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

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateway_username, gateway_password, gateway_account = nil, gateway_api_key = nil) ⇒ Configuration

Returns a new instance of Configuration.



62
63
64
65
66
67
68
# File 'lib/agms/configuration.rb', line 62

def initialize(gateway_username, gateway_password, =nil, gateway_api_key=nil)
  # TODO Add default value for max_amount and min_amount
  @@gateway_username = gateway_username
  @@gateway_password = gateway_password
  @@gateway_account = 
  @@gateway_api_key = gateway_api_key
end

Class Attribute Details

.gateway_accountObject

Returns the value of attribute gateway_account.



13
14
15
# File 'lib/agms/configuration.rb', line 13

def 
  @gateway_account
end

.gateway_api_keyObject

Returns the value of attribute gateway_api_key.



14
15
16
# File 'lib/agms/configuration.rb', line 14

def gateway_api_key
  @gateway_api_key
end

.gateway_max_amountObject

Returns the value of attribute gateway_max_amount.



15
16
17
# File 'lib/agms/configuration.rb', line 15

def gateway_max_amount
  @gateway_max_amount
end

.gateway_min_amountObject

Returns the value of attribute gateway_min_amount.



16
17
18
# File 'lib/agms/configuration.rb', line 16

def gateway_min_amount
  @gateway_min_amount
end

.gateway_passwordObject

Returns the value of attribute gateway_password.



12
13
14
# File 'lib/agms/configuration.rb', line 12

def gateway_password
  @gateway_password
end

.gateway_usernameObject

Returns the value of attribute gateway_username.



11
12
13
# File 'lib/agms/configuration.rb', line 11

def gateway_username
  @gateway_username
end

.hpp_templateObject

Returns the value of attribute hpp_template.



18
19
20
# File 'lib/agms/configuration.rb', line 18

def hpp_template
  @hpp_template
end

.portObject

Returns the value of attribute port.



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

def port
  @port
end

.serverObject

Returns the value of attribute server.



8
9
10
# File 'lib/agms/configuration.rb', line 8

def server
  @server
end

.use_unsafe_sslObject

Returns the value of attribute use_unsafe_ssl.



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

def use_unsafe_ssl
  @use_unsafe_ssl
end

.verboseObject

Returns the value of attribute verbose.



17
18
19
# File 'lib/agms/configuration.rb', line 17

def verbose
  @verbose
end

Class Method Details

.configure(gateway_username, gateway_password, gateway_account = nil, gateway_api_key = nil) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/agms/configuration.rb', line 42

def self.configure(gateway_username, gateway_password, =nil, gateway_api_key=nil)
  Configuration.server = 'gateway.agms.com'
  Configuration.port = '443'
  Configuration.use_unsafe_ssl = false

  Configuration.gateway_username = gateway_username
  Configuration.gateway_password = gateway_password
  Configuration. = 
  Configuration.gateway_api_key = gateway_api_key
end

.init(init_file) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/agms/configuration.rb', line 22

def self.init(init_file)
  Configuration.server = 'gateway.agms.com'
  Configuration.port = '443'
  Configuration.use_unsafe_ssl = false

  config = YAML::load_file(init_file)
  Configuration.gateway_username = config['username']
  Configuration.gateway_password = config['password']
  Configuration. = config['account']
  Configuration.gateway_api_key = config['api_key']
  Configuration.gateway_max_amount = config['max_amount']
  Configuration.gateway_min_amount = config['min_amount']
  if config['verbose']
    Configuration.verbose = config['verbose']
  end
  if config['hpp_template']
    Configuration.hpp_template = config['hpp_template']
  end
end

.instantiateObject



53
54
55
56
57
58
59
60
# File 'lib/agms/configuration.rb', line 53

def self.instantiate()
  return Configuration.new(
    Configuration.gateway_username,
    Configuration.gateway_password,
    Configuration.,
    Configuration.gateway_api_key,
  )
end