Class: NewStoreApi::ProfileResponse
- Defined in:
- lib/new_store_api/models/profile_response.rb
Overview
ProfileResponse Model.
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime
Timestamp of the profile creation.
-
#created_by ⇒ String
The identifier of the associate creating profile.
-
#display_id ⇒ String
The human readable profile identifier.
-
#email ⇒ String
Email of the customer.
-
#extended_attributes ⇒ Hash[String, ExtendedAttributeModel]
Additional attributes for a customer.
-
#first_name ⇒ String
First name of the customer.
-
#full_name ⇒ String
Full name of the customer, including first, middle and last name.
-
#id ⇒ String
The profile identifier.
-
#last_name ⇒ String
Last name of the customer.
-
#phone_number ⇒ String
Phone number of the customer in E.164 format.
-
#store_id ⇒ String
The identifier of the store, profile is being created in.
-
#updated_at ⇒ DateTime
Timestamp of the latest profile update.
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(created_at = nil, created_by = nil, display_id = nil, email = nil, extended_attributes = nil, first_name = nil, full_name = nil, id = nil, last_name = nil, phone_number = nil, store_id = nil, updated_at = nil) ⇒ ProfileResponse
constructor
A new instance of ProfileResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ Object
-
#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(created_at = nil, created_by = nil, display_id = nil, email = nil, extended_attributes = nil, first_name = nil, full_name = nil, id = nil, last_name = nil, phone_number = nil, store_id = nil, updated_at = nil) ⇒ ProfileResponse
Returns a new instance of ProfileResponse.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/new_store_api/models/profile_response.rb', line 89 def initialize(created_at = nil, created_by = nil, display_id = nil, email = nil, extended_attributes = nil, first_name = nil, full_name = nil, id = nil, last_name = nil, phone_number = nil, store_id = nil, updated_at = nil) @created_at = created_at @created_by = created_by @display_id = display_id @email = email @extended_attributes = extended_attributes @first_name = first_name @full_name = full_name @id = id @last_name = last_name @phone_number = phone_number @store_id = store_id @updated_at = updated_at end |
Instance Attribute Details
#created_at ⇒ DateTime
Timestamp of the profile creation.
15 16 17 |
# File 'lib/new_store_api/models/profile_response.rb', line 15 def created_at @created_at end |
#created_by ⇒ String
The identifier of the associate creating profile
19 20 21 |
# File 'lib/new_store_api/models/profile_response.rb', line 19 def created_by @created_by end |
#display_id ⇒ String
The human readable profile identifier.
23 24 25 |
# File 'lib/new_store_api/models/profile_response.rb', line 23 def display_id @display_id end |
#email ⇒ String
Email of the customer.
27 28 29 |
# File 'lib/new_store_api/models/profile_response.rb', line 27 def email @email end |
#extended_attributes ⇒ Hash[String, ExtendedAttributeModel]
Additional attributes for a customer.
31 32 33 |
# File 'lib/new_store_api/models/profile_response.rb', line 31 def extended_attributes @extended_attributes end |
#first_name ⇒ String
First name of the customer.
35 36 37 |
# File 'lib/new_store_api/models/profile_response.rb', line 35 def first_name @first_name end |
#full_name ⇒ String
Full name of the customer, including first, middle and last name.
39 40 41 |
# File 'lib/new_store_api/models/profile_response.rb', line 39 def full_name @full_name end |
#id ⇒ String
The profile identifier.
43 44 45 |
# File 'lib/new_store_api/models/profile_response.rb', line 43 def id @id end |
#last_name ⇒ String
Last name of the customer.
47 48 49 |
# File 'lib/new_store_api/models/profile_response.rb', line 47 def last_name @last_name end |
#phone_number ⇒ String
Phone number of the customer in E.164 format.
51 52 53 |
# File 'lib/new_store_api/models/profile_response.rb', line 51 def phone_number @phone_number end |
#store_id ⇒ String
The identifier of the store, profile is being created in.
55 56 57 |
# File 'lib/new_store_api/models/profile_response.rb', line 55 def store_id @store_id end |
#updated_at ⇒ DateTime
Timestamp of the latest profile update.
59 60 61 |
# File 'lib/new_store_api/models/profile_response.rb', line 59 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/new_store_api/models/profile_response.rb', line 108 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end created_by = hash.key?('created_by') ? hash['created_by'] : nil display_id = hash.key?('display_id') ? hash['display_id'] : nil email = hash.key?('email') ? hash['email'] : nil extended_attributes = ExtendedAttributeModel.from_hash(hash['extended_attributes']) if hash['extended_attributes'] extended_attributes = nil unless hash.key?('extended_attributes') first_name = hash.key?('first_name') ? hash['first_name'] : nil full_name = hash.key?('full_name') ? hash['full_name'] : nil id = hash.key?('id') ? hash['id'] : nil last_name = hash.key?('last_name') ? hash['last_name'] : nil phone_number = hash.key?('phone_number') ? hash['phone_number'] : nil store_id = hash.key?('store_id') ? hash['store_id'] : nil updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) end # Create object from extracted values. ProfileResponse.new(created_at, created_by, display_id, email, extended_attributes, first_name, full_name, id, last_name, phone_number, store_id, updated_at) end |
.names ⇒ Object
A mapping from model property names to API property names.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/new_store_api/models/profile_response.rb', line 62 def self.names @_hash = {} if @_hash.nil? @_hash['created_at'] = 'created_at' @_hash['created_by'] = 'created_by' @_hash['display_id'] = 'display_id' @_hash['email'] = 'email' @_hash['extended_attributes'] = 'extended_attributes' @_hash['first_name'] = 'first_name' @_hash['full_name'] = 'full_name' @_hash['id'] = 'id' @_hash['last_name'] = 'last_name' @_hash['phone_number'] = 'phone_number' @_hash['store_id'] = 'store_id' @_hash['updated_at'] = 'updated_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
85 86 87 |
# File 'lib/new_store_api/models/profile_response.rb', line 85 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
80 81 82 |
# File 'lib/new_store_api/models/profile_response.rb', line 80 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
166 167 168 169 170 171 172 173 174 |
# File 'lib/new_store_api/models/profile_response.rb', line 166 def inspect class_name = self.class.name.split('::').last "<#{class_name} created_at: #{@created_at.inspect}, created_by: #{@created_by.inspect},"\ " display_id: #{@display_id.inspect}, email: #{@email.inspect}, extended_attributes:"\ " #{@extended_attributes.inspect}, first_name: #{@first_name.inspect}, full_name:"\ " #{@full_name.inspect}, id: #{@id.inspect}, last_name: #{@last_name.inspect}, phone_number:"\ " #{@phone_number.inspect}, store_id: #{@store_id.inspect}, updated_at:"\ " #{@updated_at.inspect}>" end |
#to_custom_created_at ⇒ Object
147 148 149 |
# File 'lib/new_store_api/models/profile_response.rb', line 147 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
151 152 153 |
# File 'lib/new_store_api/models/profile_response.rb', line 151 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
156 157 158 159 160 161 162 163 |
# File 'lib/new_store_api/models/profile_response.rb', line 156 def to_s class_name = self.class.name.split('::').last "<#{class_name} created_at: #{@created_at}, created_by: #{@created_by}, display_id:"\ " #{@display_id}, email: #{@email}, extended_attributes: #{@extended_attributes},"\ " first_name: #{@first_name}, full_name: #{@full_name}, id: #{@id}, last_name:"\ " #{@last_name}, phone_number: #{@phone_number}, store_id: #{@store_id}, updated_at:"\ " #{@updated_at}>" end |