Class: AtPay::Session
- Inherits:
-
Object
- Object
- AtPay::Session
- Defined in:
- lib/atpay/session.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #boxer ⇒ Object
-
#initialize(options) ⇒ Session
constructor
A new instance of Session.
- #security_key(options) ⇒ Object
- #security_keys(options) ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/atpay/session.rb', line 6 def config @config end |
Instance Method Details
#boxer ⇒ Object
34 35 36 |
# File 'lib/atpay/session.rb', line 34 def boxer @boxer ||= RbNaCl::Box.new(config.atpay_public_key, config.private_key) end |
#security_key(options) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/atpay/session.rb', line 26 def security_key() if [:amount].is_a? Array security_keys() else SecurityKey.new(self, .update(:amount => [:amount])) end end |
#security_keys(options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/atpay/session.rb', line 12 def security_keys() = .clone [:group] ||= "#{SecureRandom.uuid.gsub("-", "")}-#{Time.now.to_i}" keys = [] [:amount].each do |amount| keys << security_key(.update(:amount => amount)) end keys end |