Class: Rubykassa::Configuration
- Inherits:
-
Object
- Object
- Rubykassa::Configuration
- Defined in:
- lib/rubykassa/configuration.rb
Constant Summary collapse
- ATTRIBUTES =
[ :login, :first_password, :second_password, :mode, :http_method, :xml_http_method, :success_callback, :fail_callback, :result_callback, :hash_algorithm ]
- HASH_ALGORITHMS =
[:md5, :ripemd160, :sha1, :sha256, :sha384, :sha512]
Instance Method Summary collapse
- #correct_hash_algorithm? ⇒ Boolean
- #correct_http_method? ⇒ Boolean
- #correct_mode? ⇒ Boolean
- #correct_xml_http_method? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rubykassa/configuration.rb', line 12 def initialize self.login = 'your_login' self.first_password = 'first_password' self.second_password = 'second_password' self.mode = :test self.http_method = :get self.xml_http_method = :get self.hash_algorithm = :md5 self.success_callback = ->(notification) { render text: 'success' } self.fail_callback = ->(notification) { render text: 'fail' } self.result_callback = ->(notification) do render text: notification.success end end |
Instance Method Details
#correct_hash_algorithm? ⇒ Boolean
39 40 41 |
# File 'lib/rubykassa/configuration.rb', line 39 def correct_hash_algorithm? HASH_ALGORITHMS.include?(hash_algorithm) end |
#correct_http_method? ⇒ Boolean
31 32 33 |
# File 'lib/rubykassa/configuration.rb', line 31 def correct_http_method? [:get, :post].include?(http_method) end |
#correct_mode? ⇒ Boolean
27 28 29 |
# File 'lib/rubykassa/configuration.rb', line 27 def correct_mode? [:test, :production].include?(mode) end |
#correct_xml_http_method? ⇒ Boolean
35 36 37 |
# File 'lib/rubykassa/configuration.rb', line 35 def correct_xml_http_method? [:get, :post].include?(xml_http_method) end |