class Getnet::Payment::Iframe
Constants
- PAYMENT_IFRAME_ATTRIBUTES
Attributes
attributes[W]
Public Class Methods
attributes()
click to toggle source
# File lib/getnet/payment/iframe.rb, line 39 def self.attributes PAYMENT_IFRAME_ATTRIBUTES end
new()
click to toggle source
# File lib/getnet/payment/iframe.rb, line 28 def initialize() @attributes = {} PAYMENT_IFRAME_ATTRIBUTES.each do |attr| @attributes[attr.to_sym] = nil end @attributes[:amount] = 0 @attributes[:items] = [] @attributes[:sellerid] = Getnet.seller_id @attributes[:token] = authorization.full_token end
Public Instance Methods
[](key)
click to toggle source
# File lib/getnet/payment/iframe.rb, line 52 def [](key) if key.is_a?(Symbol) || key.is_a?(String) return @attributes[key.to_sym] else raise ArgumentError, "Invalid attribute name" end end
[]=(key, value)
click to toggle source
# File lib/getnet/payment/iframe.rb, line 60 def []=(key, value) if key.is_a?(Symbol) || key.is_a?(String) @attributes[key.to_sym] = value else raise ArgumentError, "Invalid attribute name" end end
add_item(item ={})
click to toggle source
# File lib/getnet/payment/iframe.rb, line 47 def add_item(item ={}) @attributes[:items] << item @attributes[:amount] = @attributes[:amount] + item[:value] * item[:quantity] end
setup() { |attributes| ... }
click to toggle source
# File lib/getnet/payment/iframe.rb, line 43 def setup yield @attributes end