Class: MassPayRubySdk::UpdateUser

Inherits:
Object
  • Object
show all
Defined in:
lib/masspay_ruby_sdk/models/update_user.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UpdateUser

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



154
155
156
157
158
159
160
161
162
163
164
165
166
167
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
231
232
233
234
235
236
237
238
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 154

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::UpdateUser` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `MassPayRubySdk::UpdateUser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'created_on')
    self.created_on = attributes[:'created_on']
  end

  if attributes.key?(:'internal_user_id')
    self.internal_user_id = attributes[:'internal_user_id']
  end

  if attributes.key?(:'address1')
    self.address1 = attributes[:'address1']
  end

  if attributes.key?(:'address2')
    self.address2 = attributes[:'address2']
  end

  if attributes.key?(:'city')
    self.city = attributes[:'city']
  end

  if attributes.key?(:'state_province')
    self.state_province = attributes[:'state_province']
  end

  if attributes.key?(:'postal_code')
    self.postal_code = attributes[:'postal_code']
  end

  if attributes.key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.key?(:'first_name')
    self.first_name = attributes[:'first_name']
  end

  if attributes.key?(:'middle_name')
    self.middle_name = attributes[:'middle_name']
  end

  if attributes.key?(:'last_name')
    self.last_name = attributes[:'last_name']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'language')
    self.language = attributes[:'language']
  end

  if attributes.key?(:'mobile_number')
    self.mobile_number = attributes[:'mobile_number']
  end

  if attributes.key?(:'business_name')
    self.business_name = attributes[:'business_name']
  end

  if attributes.key?(:'date_of_birth')
    self.date_of_birth = attributes[:'date_of_birth']
  end

  if attributes.key?(:'metadata')
    self. = attributes[:'metadata']
  end
end

Instance Attribute Details

#address1Object

The user’s street address.



27
28
29
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 27

def address1
  @address1
end

#address2Object

The user’s street address, line 2.



30
31
32
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 30

def address2
  @address2
end

#business_nameObject

Company legal name (Only if Business account)



63
64
65
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 63

def business_name
  @business_name
end

#cityObject

The user’s city.



33
34
35
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 33

def city
  @city
end

#countryObject

The user’s country code. ISO_3166-1_alpha-3 code



42
43
44
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 42

def country
  @country
end

#created_onObject

The timestamp the user was created in the system. Using UTC timestamp.[ISO 8601](en.wikipedia.org/wiki/ISO_8601)



21
22
23
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 21

def created_on
  @created_on
end

#date_of_birthObject

Date of birth. (optional). Minimum 18 years old



66
67
68
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 66

def date_of_birth
  @date_of_birth
end

#emailObject

The user’s e-mail address. Must be unique. Cannot have two users with the same e-mail address.



54
55
56
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 54

def email
  @email
end

#first_nameObject

The user’s first name.



45
46
47
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 45

def first_name
  @first_name
end

#internal_user_idObject

A client-defined identifier for the user. This is the unique ID assigned to the user on your system. Max 75 characters. Allows letters, numbers, and + , - . / _ ~ |



24
25
26
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 24

def internal_user_id
  @internal_user_id
end

#languageObject

The user’s preferred language of communication. If not provided, defaults to English (en)



57
58
59
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 57

def language
  @language
end

#last_nameObject

The user’s last name.



51
52
53
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 51

def last_name
  @last_name
end

#metadataObject

Optional JSON object with attributes that can later be searched to locate this user. Do not include PII as this object is not encrypted.



69
70
71
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 69

def 
  @metadata
end

#middle_nameObject

The user’s middle name.



48
49
50
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 48

def middle_name
  @middle_name
end

#mobile_numberObject

(Optional) Mobile number of user. Allows for SMS notifications upon availability of funds



60
61
62
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 60

def mobile_number
  @mobile_number
end

#postal_codeObject

The user’s postal code.



39
40
41
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 39

def postal_code
  @postal_code
end

#state_provinceObject

The user’s state/province.



36
37
38
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 36

def state_province
  @state_province
end

#statusObject

The status of the user, if set to ACTIVE when current status is DEACTIVE, reactivation fee will incur



18
19
20
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 18

def status
  @status
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



118
119
120
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 118

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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

def self.attribute_map
  {
    :'status' => :'status',
    :'created_on' => :'created_on',
    :'internal_user_id' => :'internal_user_id',
    :'address1' => :'address1',
    :'address2' => :'address2',
    :'city' => :'city',
    :'state_province' => :'state_province',
    :'postal_code' => :'postal_code',
    :'country' => :'country',
    :'first_name' => :'first_name',
    :'middle_name' => :'middle_name',
    :'last_name' => :'last_name',
    :'email' => :'email',
    :'language' => :'language',
    :'mobile_number' => :'mobile_number',
    :'business_name' => :'business_name',
    :'date_of_birth' => :'date_of_birth',
    :'metadata' => :'metadata'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



372
373
374
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 372

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



147
148
149
150
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 147

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 123

def self.openapi_types
  {
    :'status' => :'String',
    :'created_on' => :'String',
    :'internal_user_id' => :'String',
    :'address1' => :'String',
    :'address2' => :'String',
    :'city' => :'String',
    :'state_province' => :'String',
    :'postal_code' => :'String',
    :'country' => :'String',
    :'first_name' => :'String',
    :'middle_name' => :'String',
    :'last_name' => :'String',
    :'email' => :'String',
    :'language' => :'String',
    :'mobile_number' => :'String',
    :'business_name' => :'String',
    :'date_of_birth' => :'Date',
    :'metadata' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 334

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      status == o.status &&
      created_on == o.created_on &&
      internal_user_id == o.internal_user_id &&
      address1 == o.address1 &&
      address2 == o.address2 &&
      city == o.city &&
      state_province == o.state_province &&
      postal_code == o.postal_code &&
      country == o.country &&
      first_name == o.first_name &&
      middle_name == o.middle_name &&
      last_name == o.last_name &&
      email == o.email &&
      language == o.language &&
      mobile_number == o.mobile_number &&
      business_name == o.business_name &&
      date_of_birth == o.date_of_birth &&
       == o.
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 403

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = MassPayRubySdk.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 474

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 379

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


359
360
361
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 359

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



365
366
367
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 365

def hash
  [status, created_on, internal_user_id, address1, address2, city, state_province, postal_code, country, first_name, middle_name, last_name, email, language, mobile_number, business_name, date_of_birth, ].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 242

def list_invalid_properties
  invalid_properties = Array.new
  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @internal_user_id.nil?
    invalid_properties.push('invalid value for "internal_user_id", internal_user_id cannot be nil.')
  end

  if @address1.nil?
    invalid_properties.push('invalid value for "address1", address1 cannot be nil.')
  end

  if @city.nil?
    invalid_properties.push('invalid value for "city", city cannot be nil.')
  end

  if @state_province.nil?
    invalid_properties.push('invalid value for "state_province", state_province cannot be nil.')
  end

  if @postal_code.nil?
    invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.')
  end

  if @country.nil?
    invalid_properties.push('invalid value for "country", country cannot be nil.')
  end

  if @first_name.nil?
    invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
  end

  if @last_name.nil?
    invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
  end

  if @email.nil?
    invalid_properties.push('invalid value for "email", email cannot be nil.')
  end

  pattern = Regexp.new(/^[0-9]+$/)
  if !@mobile_number.nil? && @mobile_number !~ pattern
    invalid_properties.push("invalid value for \"mobile_number\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



450
451
452
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 450

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 456

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



444
445
446
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 444

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/masspay_ruby_sdk/models/update_user.rb', line 294

def valid?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "DEACTIVE"])
  return false unless status_validator.valid?(@status)
  return false if @internal_user_id.nil?
  return false if @address1.nil?
  return false if @city.nil?
  return false if @state_province.nil?
  return false if @postal_code.nil?
  return false if @country.nil?
  return false if @first_name.nil?
  return false if @last_name.nil?
  return false if @email.nil?
  return false if !@mobile_number.nil? && @mobile_number !~ Regexp.new(/^[0-9]+$/)
  true
end