Class: NewStoreApi::CreateProfileRequest

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

Overview

CreateProfileRequest Model.

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(email = nil, created_by = SKIP, extended_attributes = SKIP, first_name = SKIP, full_name = SKIP, last_name = SKIP, phone_number = SKIP, store_id = SKIP) ⇒ CreateProfileRequest

Returns a new instance of CreateProfileRequest.



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/new_store_api/models/create_profile_request.rb', line 83

def initialize(email = nil, created_by = SKIP, extended_attributes = SKIP,
               first_name = SKIP, full_name = SKIP, last_name = SKIP,
               phone_number = SKIP, store_id = SKIP)
  @email = email
  @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)


18
19
20
# File 'lib/new_store_api/models/create_profile_request.rb', line 18

def created_by
  @created_by
end

#emailString

Email of the customer.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/create_profile_request.rb', line 14

def email
  @email
end

#extended_attributesHash[String, ExtendedAttributeModel]

Additional attributes for a customer.

Returns:



22
23
24
# File 'lib/new_store_api/models/create_profile_request.rb', line 22

def extended_attributes
  @extended_attributes
end

#first_nameString

The first name of the customer.

Returns:

  • (String)


26
27
28
# File 'lib/new_store_api/models/create_profile_request.rb', line 26

def first_name
  @first_name
end

#full_nameString

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

Returns:

  • (String)


30
31
32
# File 'lib/new_store_api/models/create_profile_request.rb', line 30

def full_name
  @full_name
end

#last_nameString

The last name of the customer.

Returns:

  • (String)


34
35
36
# File 'lib/new_store_api/models/create_profile_request.rb', line 34

def last_name
  @last_name
end

#phone_numberString

Phone number of the customer in E.164 format.

Returns:

  • (String)


38
39
40
# File 'lib/new_store_api/models/create_profile_request.rb', line 38

def phone_number
  @phone_number
end

#store_idString

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

Returns:

  • (String)


42
43
44
# File 'lib/new_store_api/models/create_profile_request.rb', line 42

def store_id
  @store_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/new_store_api/models/create_profile_request.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  email = hash.key?('email') ? hash['email'] : nil
  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.
  CreateProfileRequest.new(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.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/new_store_api/models/create_profile_request.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['email'] = 'email'
  @_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



72
73
74
75
76
77
78
79
80
81
# File 'lib/new_store_api/models/create_profile_request.rb', line 72

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

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/new_store_api/models/create_profile_request.rb', line 59

def self.optionals
  %w[
    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.



133
134
135
136
137
138
139
# File 'lib/new_store_api/models/create_profile_request.rb', line 133

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email.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_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
# File 'lib/new_store_api/models/create_profile_request.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email}, 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