Class: StickyIoRestfulApiV2025731::DataGetContacts

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

Overview

DataGetContacts 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(id:, email:, origin_id:, is_member:, created_at:, first_name:, last_name:, phone:, phone_key:, opted_communications:, custom_fields:, addresses:, notes:, additional_properties: nil) ⇒ DataGetContacts

Returns a new instance of DataGetContacts.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 93

def initialize(id:, email:, origin_id:, is_member:, created_at:,
               first_name:, last_name:, phone:, phone_key:,
               opted_communications:, custom_fields:, addresses:, notes:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @email = email
  @origin_id = origin_id
  @is_member = is_member
  @created_at = created_at
  @first_name = first_name
  @last_name = last_name
  @phone = phone
  @phone_key = phone_key
  @opted_communications = opted_communications
  @custom_fields = custom_fields
  @addresses = addresses
  @notes = notes
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressesArray[Object]

TODO: Write general description for this method

Returns:

  • (Array[Object])


58
59
60
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 58

def addresses
  @addresses
end

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


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

def created_at
  @created_at
end

#custom_fieldsArray[Object]

TODO: Write general description for this method

Returns:

  • (Array[Object])


54
55
56
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 54

def custom_fields
  @custom_fields
end

#emailString

TODO: Write general description for this method

Returns:

  • (String)


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

def email
  @email
end

#first_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def first_name
  @first_name
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#is_memberInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_member
  @is_member
end

#last_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def last_name
  @last_name
end

#notesArray[Object]

TODO: Write general description for this method

Returns:

  • (Array[Object])


62
63
64
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 62

def notes
  @notes
end

#opted_communicationsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


50
51
52
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 50

def opted_communications
  @opted_communications
end

#origin_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def origin_id
  @origin_id
end

#phoneString

TODO: Write general description for this method

Returns:

  • (String)


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

def phone
  @phone
end

#phone_keyString

TODO: Write general description for this method

Returns:

  • (String)


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

def phone_key
  @phone_key
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 117

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  email = hash.key?('email') ? hash['email'] : nil
  origin_id = hash.key?('origin_id') ? hash['origin_id'] : nil
  is_member = hash.key?('is_member') ? hash['is_member'] : nil
  created_at = hash.key?('created_at') ? hash['created_at'] : nil
  first_name = hash.key?('first_name') ? hash['first_name'] : nil
  last_name = hash.key?('last_name') ? hash['last_name'] : nil
  phone = hash.key?('phone') ? hash['phone'] : nil
  phone_key = hash.key?('phone_key') ? hash['phone_key'] : nil
  opted_communications =
    hash.key?('opted_communications') ? hash['opted_communications'] : nil
  custom_fields = hash.key?('custom_fields') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:DataGetContactsCustomFields), hash['custom_fields']
  ) : nil
  addresses = hash.key?('addresses') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:DataGetContactsAddresses), hash['addresses']
  ) : nil
  notes = hash.key?('notes') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:DataGetContactsNotes), hash['notes']
  ) : nil

  # 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.
  DataGetContacts.new(id: id,
                      email: email,
                      origin_id: origin_id,
                      is_member: is_member,
                      created_at: created_at,
                      first_name: first_name,
                      last_name: last_name,
                      phone: phone,
                      phone_key: phone_key,
                      opted_communications: opted_communications,
                      custom_fields: custom_fields,
                      addresses: addresses,
                      notes: notes,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['email'] = 'email'
  @_hash['origin_id'] = 'origin_id'
  @_hash['is_member'] = 'is_member'
  @_hash['created_at'] = 'created_at'
  @_hash['first_name'] = 'first_name'
  @_hash['last_name'] = 'last_name'
  @_hash['phone'] = 'phone'
  @_hash['phone_key'] = 'phone_key'
  @_hash['opted_communications'] = 'opted_communications'
  @_hash['custom_fields'] = 'custom_fields'
  @_hash['addresses'] = 'addresses'
  @_hash['notes'] = 'notes'
  @_hash
end

.nullablesObject

An array for nullable fields



89
90
91
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 89

def self.nullables
  []
end

.optionalsObject

An array for optional fields



84
85
86
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 84

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (DataGetContacts | Hash)

    value against the validation is performed.



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 168

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.id,
                            ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.email,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.origin_id,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.is_member,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.created_at,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.first_name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.last_name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.phone,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.phone_key,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.opted_communications,
                              ->(val) { val.instance_of? Integer }) and
        UnionTypeLookUp.get(:DataGetContactsCustomFields)
                       .validate(value.custom_fields) and
        UnionTypeLookUp.get(:DataGetContactsAddresses)
                       .validate(value.addresses) and
        UnionTypeLookUp.get(:DataGetContactsNotes)
                       .validate(value.notes)
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['id'],
                          ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['email'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['origin_id'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['is_member'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['created_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['first_name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['last_name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['phone'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['phone_key'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['opted_communications'],
                            ->(val) { val.instance_of? Integer }) and
      UnionTypeLookUp.get(:DataGetContactsCustomFields)
                     .validate(value['custom_fields']) and
      UnionTypeLookUp.get(:DataGetContactsAddresses)
                     .validate(value['addresses']) and
      UnionTypeLookUp.get(:DataGetContactsNotes)
                     .validate(value['notes'])
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



243
244
245
246
247
248
249
250
251
252
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 243

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, email: #{@email.inspect}, origin_id:"\
  " #{@origin_id.inspect}, is_member: #{@is_member.inspect}, created_at:"\
  " #{@created_at.inspect}, first_name: #{@first_name.inspect}, last_name:"\
  " #{@last_name.inspect}, phone: #{@phone.inspect}, phone_key: #{@phone_key.inspect},"\
  " opted_communications: #{@opted_communications.inspect}, custom_fields:"\
  " #{@custom_fields.inspect}, addresses: #{@addresses.inspect}, notes: #{@notes.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



233
234
235
236
237
238
239
240
# File 'lib/sticky_io_restful_api_v2025731/models/data_get_contacts.rb', line 233

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, email: #{@email}, origin_id: #{@origin_id}, is_member:"\
  " #{@is_member}, created_at: #{@created_at}, first_name: #{@first_name}, last_name:"\
  " #{@last_name}, phone: #{@phone}, phone_key: #{@phone_key}, opted_communications:"\
  " #{@opted_communications}, custom_fields: #{@custom_fields}, addresses: #{@addresses},"\
  " notes: #{@notes}, additional_properties: #{@additional_properties}>"
end