Class: Upay::People::Buyer

Inherits:
Person
  • Object
show all
Defined in:
lib/upay/people/buyer.rb

Instance Method Summary collapse

Methods inherited from Person

#contactPhone, #contactPhone=, #emailAddress, #emailAddress=, #fullName, #fullName=, #initialize

Constructor Details

This class inherits a constructor from Upay::People::Person

Instance Method Details

#dniNumberObject



11
# File 'lib/upay/people/buyer.rb', line 11

def dniNumber; @dniNumber end

#dniNumber=(dniNumber = nil) ⇒ Object



12
# File 'lib/upay/people/buyer.rb', line 12

def dniNumber=(dniNumber = nil) @dniNumber = dniNumber; end

#idObject



5
# File 'lib/upay/people/buyer.rb', line 5

def id; @id end

#id=(id = nil) ⇒ Object



6
# File 'lib/upay/people/buyer.rb', line 6

def id=(id = nil) @id = id; end

#merchantBuyerIdObject



8
# File 'lib/upay/people/buyer.rb', line 8

def merchantBuyerId; @merchantBuyerId || @id end

#merchantBuyerId=(merchantBuyerId = nil) ⇒ Object



9
# File 'lib/upay/people/buyer.rb', line 9

def merchantBuyerId=(merchantBuyerId = nil) @merchantBuyerId = merchantBuyerId; end

#shippingAddressObject



14
# File 'lib/upay/people/buyer.rb', line 14

def shippingAddress; @shippingAddress end

#shippingAddress=(shippingAddress = nil) ⇒ Object



15
# File 'lib/upay/people/buyer.rb', line 15

def shippingAddress=(shippingAddress = nil) @shippingAddress = shippingAddress; end

#to_hashObject



22
23
24
25
26
# File 'lib/upay/people/buyer.rb', line 22

def to_hash
  person_hash = self.instance_variables.each_with_object({}) { |var,hash| hash[var.to_s.delete("@").to_sym] = self.instance_variable_get(var)}
  person_hash[:shippingAddress] = self.shippingAddress.to_hash if self.shippingAddress
  person_hash
end

#valid?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/upay/people/buyer.rb', line 17

def valid?
  validator = BuyerValidator.new
  validator.valid?(self)
end