Class: NewStoreApi::UpdateProfileRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/update_profile_request.rb

Overview

Update profile request.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(last_updated_at = nil, email = SKIP, created_by = SKIP, extended_attributes = SKIP, first_name = SKIP, full_name = SKIP, last_name = SKIP, phone_number = SKIP, store_id = SKIP) ⇒ UpdateProfileRequest

Returns a new instance of UpdateProfileRequest.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/new_store_api/models/update_profile_request.rb', line 90

def initialize(last_updated_at = nil, email = SKIP, created_by = SKIP,
               extended_attributes = SKIP, first_name = SKIP,
               full_name = SKIP, last_name = SKIP, phone_number = SKIP,
               store_id = SKIP)
  @email = email unless email == SKIP
  @last_updated_at = last_updated_at
  @created_by = created_by unless created_by == SKIP
  @extended_attributes = extended_attributes unless extended_attributes == SKIP
  @first_name = first_name unless first_name == SKIP
  @full_name = full_name unless full_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @store_id = store_id unless store_id == SKIP
end

Instance Attribute Details

#created_byString

The identifier of the associate creating profile

Returns:

  • (String)


23
24
25
# File 'lib/new_store_api/models/update_profile_request.rb', line 23

def created_by
  @created_by
end

#emailString

Email of the customer.

Returns:

  • (String)


15
16
17
# File 'lib/new_store_api/models/update_profile_request.rb', line 15

def email
  @email
end

#extended_attributesHash[String, ExtendedAttributeModel]

Additional attributes for a customer.

Returns:



27
28
29
# File 'lib/new_store_api/models/update_profile_request.rb', line 27

def extended_attributes
  @extended_attributes
end

#first_nameString

The first name of the customer.

Returns:

  • (String)


31
32
33
# File 'lib/new_store_api/models/update_profile_request.rb', line 31

def first_name
  @first_name
end

#full_nameString

Full name of the customer, including first, middle and last name.

Returns:

  • (String)


35
36
37
# File 'lib/new_store_api/models/update_profile_request.rb', line 35

def full_name
  @full_name
end

#last_nameString

The last name of the customer.

Returns:

  • (String)


39
40
41
# File 'lib/new_store_api/models/update_profile_request.rb', line 39

def last_name
  @last_name
end

#last_updated_atDateTime

Timestamp of the latest profile update.

Returns:

  • (DateTime)


19
20
21
# File 'lib/new_store_api/models/update_profile_request.rb', line 19

def last_updated_at
  @last_updated_at
end

#phone_numberString

Phone number of the customer in E.164 format.

Returns:

  • (String)


43
44
45
# File 'lib/new_store_api/models/update_profile_request.rb', line 43

def phone_number
  @phone_number
end

#store_idString

The identifier of the store, profile is being created in.

Returns:

  • (String)


47
48
49
# File 'lib/new_store_api/models/update_profile_request.rb', line 47

def store_id
  @store_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



106
107
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
# File 'lib/new_store_api/models/update_profile_request.rb', line 106

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  last_updated_at = if hash.key?('last_updated_at')
                      (DateTimeHelper.from_rfc3339(hash['last_updated_at']) if hash['last_updated_at'])
                    end
  email = hash.key?('email') ? hash['email'] : SKIP
  created_by = hash.key?('created_by') ? hash['created_by'] : SKIP
  extended_attributes = ExtendedAttributeModel.from_hash(hash['extended_attributes']) if
    hash['extended_attributes']

  extended_attributes = SKIP unless hash.key?('extended_attributes')
  first_name = hash.key?('first_name') ? hash['first_name'] : SKIP
  full_name = hash.key?('full_name') ? hash['full_name'] : SKIP
  last_name = hash.key?('last_name') ? hash['last_name'] : SKIP
  phone_number = hash.key?('phone_number') ? hash['phone_number'] : SKIP
  store_id = hash.key?('store_id') ? hash['store_id'] : SKIP

  # Create object from extracted values.
  UpdateProfileRequest.new(last_updated_at,
                           email,
                           created_by,
                           extended_attributes,
                           first_name,
                           full_name,
                           last_name,
                           phone_number,
                           store_id)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/new_store_api/models/update_profile_request.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['email'] = 'email'
  @_hash['last_updated_at'] = 'last_updated_at'
  @_hash['created_by'] = 'created_by'
  @_hash['extended_attributes'] = 'extended_attributes'
  @_hash['first_name'] = 'first_name'
  @_hash['full_name'] = 'full_name'
  @_hash['last_name'] = 'last_name'
  @_hash['phone_number'] = 'phone_number'
  @_hash['store_id'] = 'store_id'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
82
83
84
85
86
87
88
# File 'lib/new_store_api/models/update_profile_request.rb', line 79

def self.nullables
  %w[
    created_by
    first_name
    full_name
    last_name
    phone_number
    store_id
  ]
end

.optionalsObject

An array for optional fields



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/new_store_api/models/update_profile_request.rb', line 65

def self.optionals
  %w[
    email
    created_by
    extended_attributes
    first_name
    full_name
    last_name
    phone_number
    store_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



151
152
153
154
155
156
157
158
# File 'lib/new_store_api/models/update_profile_request.rb', line 151

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email.inspect}, last_updated_at: #{@last_updated_at.inspect},"\
  " created_by: #{@created_by.inspect}, extended_attributes: #{@extended_attributes.inspect},"\
  " first_name: #{@first_name.inspect}, full_name: #{@full_name.inspect}, last_name:"\
  " #{@last_name.inspect}, phone_number: #{@phone_number.inspect}, store_id:"\
  " #{@store_id.inspect}>"
end

#to_custom_last_updated_atObject



137
138
139
# File 'lib/new_store_api/models/update_profile_request.rb', line 137

def to_custom_last_updated_at
  DateTimeHelper.to_rfc3339(last_updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



142
143
144
145
146
147
148
# File 'lib/new_store_api/models/update_profile_request.rb', line 142

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email}, last_updated_at: #{@last_updated_at}, created_by:"\
  " #{@created_by}, extended_attributes: #{@extended_attributes}, first_name: #{@first_name},"\
  " full_name: #{@full_name}, last_name: #{@last_name}, phone_number: #{@phone_number},"\
  " store_id: #{@store_id}>"
end