Class: NewStoreApi::SalesOrderCustomer
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::SalesOrderCustomer
- Defined in:
- lib/new_store_api/models/sales_order_customer.rb
Overview
SalesOrderCustomer Model.
Instance Attribute Summary collapse
-
#email ⇒ String
The email address of the customer.
-
#id ⇒ String
The identifier of the customer.
-
#language ⇒ String
The code of the language to be used in communicating with the customer in ISO 639-1 format, e.g.
-
#name ⇒ String
The full name of the customer.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(email = SKIP, id = SKIP, language = SKIP, name = SKIP) ⇒ SalesOrderCustomer
constructor
A new instance of SalesOrderCustomer.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(email = SKIP, id = SKIP, language = SKIP, name = SKIP) ⇒ SalesOrderCustomer
Returns a new instance of SalesOrderCustomer.
54 55 56 57 58 59 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 54 def initialize(email = SKIP, id = SKIP, language = SKIP, name = SKIP) @email = email unless email == SKIP @id = id unless id == SKIP @language = language unless language == SKIP @name = name unless name == SKIP end |
Instance Attribute Details
#email ⇒ String
The email address of the customer.
14 15 16 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 14 def email @email end |
#id ⇒ String
The identifier of the customer.
18 19 20 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 18 def id @id end |
#language ⇒ String
The code of the language to be used in communicating with the customer in ISO 639-1 format, e.g. fr, de or en.
23 24 25 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 23 def language @language end |
#name ⇒ String
The full name of the customer.
27 28 29 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 27 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. email = hash.key?('email') ? hash['email'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP language = hash.key?('language') ? hash['language'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP # Create object from extracted values. SalesOrderCustomer.new(email, id, language, name) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['email'] = 'email' @_hash['id'] = 'id' @_hash['language'] = 'language' @_hash['name'] = 'name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 47 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 40 def self.optionals %w[ email id language name ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
85 86 87 88 89 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 85 def inspect class_name = self.class.name.split('::').last "<#{class_name} email: #{@email.inspect}, id: #{@id.inspect}, language:"\ " #{@language.inspect}, name: #{@name.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
79 80 81 82 |
# File 'lib/new_store_api/models/sales_order_customer.rb', line 79 def to_s class_name = self.class.name.split('::').last "<#{class_name} email: #{@email}, id: #{@id}, language: #{@language}, name: #{@name}>" end |