class Upay::Order

Public Class Methods

new(args = {}) click to toggle source
# File lib/upay/order.rb, line 3
def initialize(args = {})
  args.each do |k,v|
    instance_variable_set("@#{k}", v)
  end
  instance_variable_set("@accountId", Upay.account_id)
  instance_variable_set("@language", Upay.lang)
  instance_variable_set("@notifyUrl", Upay.notifyUrl)
end

Public Instance Methods

accountId() click to toggle source
# File lib/upay/order.rb, line 12
def accountId; @accountId end
additionalValues() click to toggle source
# File lib/upay/order.rb, line 16
def additionalValues; @additionalValues end
additionalValues=(additionalValues = {}) click to toggle source
# File lib/upay/order.rb, line 17
def additionalValues=(additionalValues = {}); @additionalValues end
buyer() click to toggle source
# File lib/upay/order.rb, line 29
def buyer; @buyer end
buyer=(buyer = {}) click to toggle source
# File lib/upay/order.rb, line 30
def buyer=(buyer = {}) @buyer = buyer; end
description() click to toggle source
# File lib/upay/order.rb, line 23
def description; @description end
description=(description = nil) click to toggle source
# File lib/upay/order.rb, line 24
def description=(description = nil) @description = description; end
language() click to toggle source
# File lib/upay/order.rb, line 13
def language; @language end
notifyUrl() click to toggle source
# File lib/upay/order.rb, line 14
def notifyUrl; @notifyUrl end
referenceCode() click to toggle source
# File lib/upay/order.rb, line 20
def referenceCode; @referenceCode end
referenceCode=(referenceCode = nil) click to toggle source
# File lib/upay/order.rb, line 21
def referenceCode=(referenceCode = nil) @referenceCode = referenceCode; end
shippingAddress() click to toggle source
# File lib/upay/order.rb, line 32
def shippingAddress; @shippingAddress end
shippingAddress=(shippingAddress = {}) click to toggle source
# File lib/upay/order.rb, line 33
def shippingAddress=(shippingAddress = {}) @shippingAddress = shippingAddress; end
signature() click to toggle source
# File lib/upay/order.rb, line 26
def signature; @signature end
signature=(signature = nil) click to toggle source
# File lib/upay/order.rb, line 27
def signature=(signature = nil) @signature = signature; end
to_hash() click to toggle source
# File lib/upay/order.rb, line 40
def to_hash
  order_hash = self.instance_variables.each_with_object({}) { |var,hash| hash[var.to_s.delete("@").to_sym] = self.instance_variable_get(var)}
  order_hash[:buyer] = self.buyer.to_hash if self.buyer
  order_hash[:shippingAddress] = self.shippingAddress.to_hash if self.shippingAddress
  order_hash
end
valid?() click to toggle source
# File lib/upay/order.rb, line 35
def valid?
  validator = OrderValidator.new
  validator.valid?(self)
end