Module: NitroPay
- Defined in:
- lib/nitro_pay.rb,
lib/nitro_pay/status.rb,
lib/nitro_pay/version.rb,
lib/nitro_pay/currency.rb,
lib/nitro_pay/connection.rb,
lib/nitro_pay/transaction.rb,
lib/generators/nitro_pay/install_generator.rb
Defined Under Namespace
Modules: Generators
Classes: Connection, Currency, Status, Transaction
Constant Summary
collapse
- MAJOR =
1
- MINOR =
0
- PATCH =
8
- VERSION =
"#{MAJOR}.#{MINOR}.#{PATCH}"
- @@enum =
nil
- @@app_id =
nil
- @@secret_key =
nil
- @@proxy_yml =
nil
- @@test_env =
nil
- @@debug =
nil
Class Method Summary
collapse
Class Method Details
.app_id ⇒ Object
43
44
45
|
# File 'lib/nitro_pay.rb', line 43
def self.app_id
@@app_id
end
|
.app_id=(app_id) ⇒ Object
39
40
41
|
# File 'lib/nitro_pay.rb', line 39
def self.app_id=(app_id)
@@app_id = app_id
end
|
.debug ⇒ Object
63
64
65
|
# File 'lib/nitro_pay.rb', line 63
def self.debug
@@debug
end
|
.debug=(debug) ⇒ Object
67
68
69
|
# File 'lib/nitro_pay.rb', line 67
def self.debug=(debug)
@@debug = debug
end
|
.enum ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/nitro_pay.rb', line 76
def self.enum
enum = {}
return @@enum unless @@enum.nil?
enum = enum.merge load_yml('brands.yml')
enum = enum.merge load_yml('currencies.yml')
enum = enum.merge load_yml('payment_methods.yml')
enum = enum.merge load_yml('recurrence_periods.yml')
enum = enum.merge load_yml('transaction_codes.yml')
enum = enum.it_keys_to_sym
@@enum = enum
end
|
.get_proxy_from_yml ⇒ Object
71
72
73
74
|
# File 'lib/nitro_pay.rb', line 71
def self.get_proxy_from_yml
yml = YAML::load_file(File.join(File.dirname(File.expand_path(__FILE__)), 'nitro_pay/config/proxy.yml'))
!yml.nil? || yml.is_a?(Hash) ? yml.it_keys_to_sym : {} if yml
end
|
.load_yml(file_name) ⇒ Object
90
91
92
|
# File 'lib/nitro_pay.rb', line 90
def self.load_yml(file_name)
YAML::load_file(File.join(File.dirname(File.expand_path(__FILE__)), 'nitro_pay/config/enums/' + file_name))
end
|
.proxy ⇒ Object
34
35
36
37
|
# File 'lib/nitro_pay.rb', line 34
def self.proxy
return nil if NitroPay.proxy_yml.nil? || NitroPay.proxy_yml.empty?
"http://#{NitroPay.proxy_yml[:login]}:#{NitroPay.proxy_yml[:password]}@#{NitroPay.proxy_yml[:host]}:#{NitroPay.proxy_yml[:port]}/"
end
|
.proxy_yml ⇒ Object
29
30
31
32
|
# File 'lib/nitro_pay.rb', line 29
def self.proxy_yml
@@proxy_yml = NitroPay.get_proxy_from_yml if @@proxy_yml.nil?
@@proxy_yml
end
|
.secret_key ⇒ Object
51
52
53
|
# File 'lib/nitro_pay.rb', line 51
def self.secret_key
@@secret_key
end
|
.secret_key=(secret_key) ⇒ Object
47
48
49
|
# File 'lib/nitro_pay.rb', line 47
def self.secret_key=(secret_key)
@@secret_key = secret_key
end
|
.test_env ⇒ Object
55
56
57
|
# File 'lib/nitro_pay.rb', line 55
def self.test_env
@@test_env
end
|
.test_env=(test_env) ⇒ Object
59
60
61
|
# File 'lib/nitro_pay.rb', line 59
def self.test_env=(test_env)
@@test_env = test_env
end
|