Class: StickyIoRestfulApiV2025731::UpdateCustomerRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb

Overview

UpdateCustomerRequest 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(dob:, gender:, email:, phone:, first_name:, last_name:, nick_name:, tax_exemption:, custom_fields:, additional_properties: nil) ⇒ UpdateCustomerRequest

Returns a new instance of UpdateCustomerRequest.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 73

def initialize(dob:, gender:, email:, phone:, first_name:, last_name:,
               nick_name:, tax_exemption:, custom_fields:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @dob = dob
  @gender = gender
  @email = email
  @phone = phone
  @first_name = first_name
  @last_name = last_name
  @nick_name = nick_name
  @tax_exemption = tax_exemption
  @custom_fields = custom_fields
  @additional_properties = additional_properties
end

Instance Attribute Details

#custom_fieldsArray[CustomFieldUpdateCustomerRequest]

TODO: Write general description for this method



46
47
48
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 46

def custom_fields
  @custom_fields
end

#dobString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 14

def dob
  @dob
end

#emailString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 22

def email
  @email
end

#first_nameString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 30

def first_name
  @first_name
end

#genderString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 18

def gender
  @gender
end

#last_nameString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 34

def last_name
  @last_name
end

#nick_nameString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 38

def nick_name
  @nick_name
end

#phoneString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 26

def phone
  @phone
end

#tax_exemptionString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 42

def tax_exemption
  @tax_exemption
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



92
93
94
95
96
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
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  dob = hash.key?('dob') ? hash['dob'] : nil
  gender = hash.key?('gender') ? hash['gender'] : nil
  email = hash.key?('email') ? hash['email'] : nil
  phone = hash.key?('phone') ? hash['phone'] : nil
  first_name = hash.key?('first_name') ? hash['first_name'] : nil
  last_name = hash.key?('last_name') ? hash['last_name'] : nil
  nick_name = hash.key?('nick_name') ? hash['nick_name'] : nil
  tax_exemption = hash.key?('tax_exemption') ? hash['tax_exemption'] : nil
  # Parameter is an array, so we need to iterate through it
  custom_fields = nil
  unless hash['custom_fields'].nil?
    custom_fields = []
    hash['custom_fields'].each do |structure|
      custom_fields << (CustomFieldUpdateCustomerRequest.from_hash(structure) if structure)
    end
  end

  custom_fields = nil unless hash.key?('custom_fields')

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UpdateCustomerRequest.new(dob: dob,
                            gender: gender,
                            email: email,
                            phone: phone,
                            first_name: first_name,
                            last_name: last_name,
                            nick_name: nick_name,
                            tax_exemption: tax_exemption,
                            custom_fields: custom_fields,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['dob'] = 'dob'
  @_hash['gender'] = 'gender'
  @_hash['email'] = 'email'
  @_hash['phone'] = 'phone'
  @_hash['first_name'] = 'first_name'
  @_hash['last_name'] = 'last_name'
  @_hash['nick_name'] = 'nick_name'
  @_hash['tax_exemption'] = 'tax_exemption'
  @_hash['custom_fields'] = 'custom_fields'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 64

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



145
146
147
148
149
150
151
152
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 145

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} dob: #{@dob.inspect}, gender: #{@gender.inspect}, email: #{@email.inspect},"\
  " phone: #{@phone.inspect}, first_name: #{@first_name.inspect}, last_name:"\
  " #{@last_name.inspect}, nick_name: #{@nick_name.inspect}, tax_exemption:"\
  " #{@tax_exemption.inspect}, custom_fields: #{@custom_fields.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



136
137
138
139
140
141
142
# File 'lib/sticky_io_restful_api_v2025731/models/update_customer_request.rb', line 136

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} dob: #{@dob}, gender: #{@gender}, email: #{@email}, phone: #{@phone},"\
  " first_name: #{@first_name}, last_name: #{@last_name}, nick_name: #{@nick_name},"\
  " tax_exemption: #{@tax_exemption}, custom_fields: #{@custom_fields}, additional_properties:"\
  " #{@additional_properties}>"
end