class Braspag::Customer
Customer
data
@attr [String] name Customer
name @attr [String] email Customer
email @attr [String] birthDate Customer's birth date @attr [String] identity Customer
id @attr [String] identityType The type of customer id @attr [Address] address Customer's address @attr [Address] deliveryAddress The delivery address
Attributes
address[RW]
birth_date[RW]
delivery_adress[RW]
email[RW]
identity[RW]
identity_type[RW]
name[RW]
Public Class Methods
from_json(data)
click to toggle source
# File lib/braspag/api/customer.rb, line 30 def self.from_json(data) if (data != nil) customer = Customer.new(data["Name"] || nil) customer.email = data["Email"] || nil customer.birth_date = data["BirthDate"] || nil customer.identity = data["Identity"] || nil customer.identity_type = data["IdentityType"] || nil customer.address = Address.from_json(data["Address"] || nil) customer.delivery_adress = Address.from_json(data["DeliveryAddress"] || nil) return customer end end
new(name)
click to toggle source
# File lib/braspag/api/customer.rb, line 20 def initialize(name) @name = name end
Public Instance Methods
to_json(*options)
click to toggle source
# File lib/braspag/api/customer.rb, line 24 def to_json(*options) hash = as_json(*options) hash.reject! {|k,v| v.nil?} hash.to_json(*options) end
Private Instance Methods
as_json(options={})
click to toggle source
# File lib/braspag/api/customer.rb, line 46 def as_json(options={}) { Name: @name, Email: @email, BirthDate: @birth_date, Identity: @identity, IdentityType: @identity_type, Address: @address, DeliveryAddress: @delivery_address } end