Class: Braspag::Customer
- Inherits:
-
Object
- Object
- Braspag::Customer
- Defined in:
- lib/braspag/api/customer.rb
Overview
Customer data
Instance Attribute Summary collapse
-
#address ⇒ Address
Customer’s address.
-
#birth_date ⇒ Object
Returns the value of attribute birth_date.
-
#birthDate ⇒ String
Customer’s birth date.
-
#delivery_adress ⇒ Object
Returns the value of attribute delivery_adress.
-
#deliveryAddress ⇒ Address
The delivery address.
-
#email ⇒ String
Customer email.
-
#identity ⇒ String
Customer id.
-
#identity_type ⇒ Object
Returns the value of attribute identity_type.
-
#identityType ⇒ String
The type of customer id.
-
#name ⇒ String
Customer name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Customer
constructor
A new instance of Customer.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(name) ⇒ Customer
Returns a new instance of Customer.
20 21 22 |
# File 'lib/braspag/api/customer.rb', line 20 def initialize(name) @name = name end |
Instance Attribute Details
#address ⇒ Address
Customer’s address
11 12 13 |
# File 'lib/braspag/api/customer.rb', line 11 def address @address end |
#birth_date ⇒ Object
Returns the value of attribute birth_date.
12 13 14 |
# File 'lib/braspag/api/customer.rb', line 12 def birth_date @birth_date end |
#birthDate ⇒ String
Customer’s birth date
11 12 13 |
# File 'lib/braspag/api/customer.rb', line 11 def birthDate @birthDate end |
#delivery_adress ⇒ Object
Returns the value of attribute delivery_adress.
12 13 14 |
# File 'lib/braspag/api/customer.rb', line 12 def delivery_adress @delivery_adress end |
#deliveryAddress ⇒ Address
The delivery address
11 12 13 |
# File 'lib/braspag/api/customer.rb', line 11 def deliveryAddress @deliveryAddress end |
#email ⇒ String
Customer email
11 12 13 |
# File 'lib/braspag/api/customer.rb', line 11 def email @email end |
#identity ⇒ String
Customer id
11 12 13 |
# File 'lib/braspag/api/customer.rb', line 11 def identity @identity end |
#identity_type ⇒ Object
Returns the value of attribute identity_type.
12 13 14 |
# File 'lib/braspag/api/customer.rb', line 12 def identity_type @identity_type end |
#identityType ⇒ String
The type of customer id
11 12 13 |
# File 'lib/braspag/api/customer.rb', line 11 def identityType @identityType end |
#name ⇒ String
Customer name
11 12 13 |
# File 'lib/braspag/api/customer.rb', line 11 def name @name end |
Class Method Details
.from_json(data) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# 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 |
Instance Method Details
#to_json(*options) ⇒ Object
24 25 26 27 28 |
# File 'lib/braspag/api/customer.rb', line 24 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |