Class: Agms::Configuration
- Inherits:
-
Object
- Object
- Agms::Configuration
- Defined in:
- lib/agms/configuration.rb
Class Attribute Summary collapse
-
.gateway_account ⇒ Object
Returns the value of attribute gateway_account.
-
.gateway_api_key ⇒ Object
Returns the value of attribute gateway_api_key.
-
.gateway_max_amount ⇒ Object
Returns the value of attribute gateway_max_amount.
-
.gateway_min_amount ⇒ Object
Returns the value of attribute gateway_min_amount.
-
.gateway_password ⇒ Object
Returns the value of attribute gateway_password.
-
.gateway_username ⇒ Object
Returns the value of attribute gateway_username.
-
.hpp_template ⇒ Object
Returns the value of attribute hpp_template.
-
.port ⇒ Object
Returns the value of attribute port.
-
.server ⇒ Object
Returns the value of attribute server.
-
.use_unsafe_ssl ⇒ Object
Returns the value of attribute use_unsafe_ssl.
-
.verbose ⇒ Object
Returns the value of attribute verbose.
Class Method Summary collapse
- .configure(gateway_username, gateway_password, gateway_account = nil, gateway_api_key = nil) ⇒ Object
- .init(init_file) ⇒ Object
- .instantiate ⇒ Object
Instance Method Summary collapse
-
#initialize(gateway_username, gateway_password, gateway_account = nil, gateway_api_key = nil) ⇒ Configuration
constructor
A new instance of Configuration.
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, gateway_account=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_account @@gateway_api_key = gateway_api_key end |
Class Attribute Details
.gateway_account ⇒ Object
Returns the value of attribute gateway_account.
13 14 15 |
# File 'lib/agms/configuration.rb', line 13 def gateway_account @gateway_account end |
.gateway_api_key ⇒ Object
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_amount ⇒ Object
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_amount ⇒ Object
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_password ⇒ Object
Returns the value of attribute gateway_password.
12 13 14 |
# File 'lib/agms/configuration.rb', line 12 def gateway_password @gateway_password end |
.gateway_username ⇒ Object
Returns the value of attribute gateway_username.
11 12 13 |
# File 'lib/agms/configuration.rb', line 11 def gateway_username @gateway_username end |
.hpp_template ⇒ Object
Returns the value of attribute hpp_template.
18 19 20 |
# File 'lib/agms/configuration.rb', line 18 def hpp_template @hpp_template end |
.port ⇒ Object
Returns the value of attribute port.
9 10 11 |
# File 'lib/agms/configuration.rb', line 9 def port @port end |
.server ⇒ Object
Returns the value of attribute server.
8 9 10 |
# File 'lib/agms/configuration.rb', line 8 def server @server end |
.use_unsafe_ssl ⇒ Object
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 |
.verbose ⇒ Object
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, gateway_account=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.gateway_account = gateway_account 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.gateway_account = 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 |
.instantiate ⇒ Object
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.gateway_account, Configuration.gateway_api_key, ) end |