Class: MassPayRubySdk::User
- Inherits:
-
Object
- Object
- MassPayRubySdk::User
- Defined in:
- lib/masspay_ruby_sdk/models/user.rb
Instance Attribute Summary collapse
-
#address1 ⇒ Object
The user’s street address.
-
#address2 ⇒ Object
The user’s street address, line 2.
-
#business_name ⇒ Object
Company legal name (Only if Business account).
-
#city ⇒ Object
The user’s city.
-
#country ⇒ Object
The user’s country code.
-
#date_of_birth ⇒ Object
Date of birth.
-
#email ⇒ Object
The user’s e-mail address.
-
#first_name ⇒ Object
The user’s first name.
-
#internal_user_id ⇒ Object
A client-defined identifier for the user.
-
#language ⇒ Object
The user’s preferred language of communication.
-
#last_name ⇒ Object
The user’s last name.
-
#metadata ⇒ Object
Optional JSON object with attributes that can later be searched to locate this user.
-
#middle_name ⇒ Object
The user’s middle name.
-
#mobile_number ⇒ Object
(Optional) Mobile number of user.
-
#notify_user ⇒ Object
Should we notify the user via email that their user has been created in the system? They will receive instructions to establish such account.
-
#postal_code ⇒ Object
The user’s postal code.
-
#state_province ⇒ Object
The user’s state/province.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ User
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ User
Initializes the object
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 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 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 127 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `MassPayRubySdk::User` 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::User`. 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?(:'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 if attributes.key?(:'notify_user') self.notify_user = attributes[:'notify_user'] else self.notify_user = false end end |
Instance Attribute Details
#address1 ⇒ Object
The user’s street address. Required in order to process a payout.
21 22 23 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 21 def address1 @address1 end |
#address2 ⇒ Object
The user’s street address, line 2.
24 25 26 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 24 def address2 @address2 end |
#business_name ⇒ Object
Company legal name (Only if Business account)
57 58 59 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 57 def business_name @business_name end |
#city ⇒ Object
The user’s city. Required in order to process a payout.
27 28 29 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 27 def city @city end |
#country ⇒ Object
The user’s country code. [ISO_3166](en.wikipedia.org/wiki/ISO_3166-1_alpha-3) code. Required in order to process a payout.
36 37 38 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 36 def country @country end |
#date_of_birth ⇒ Object
Date of birth. (optional). Minimum 18 years old
60 61 62 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 60 def date_of_birth @date_of_birth end |
#email ⇒ Object
The user’s e-mail address. Must be unique. Cannot have two users with the same e-mail address.
48 49 50 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 48 def email @email end |
#first_name ⇒ Object
The user’s first name. (If Business account, the first name of the representative)
39 40 41 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 39 def first_name @first_name end |
#internal_user_id ⇒ Object
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 + , - . / _ ~ |
18 19 20 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 18 def internal_user_id @internal_user_id end |
#language ⇒ Object
The user’s preferred language of communication. If not provided, defaults to English (en)
51 52 53 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 51 def language @language end |
#last_name ⇒ Object
The user’s last name. (If Business account, the last name of the representative)
45 46 47 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 45 def last_name @last_name end |
#metadata ⇒ Object
Optional JSON object with attributes that can later be searched to locate this user. Do not include PII as this object is not encrypted.
63 64 65 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 63 def @metadata end |
#middle_name ⇒ Object
The user’s middle name. (If Business account, the middle name of the representative)
42 43 44 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 42 def middle_name @middle_name end |
#mobile_number ⇒ Object
(Optional) Mobile number of user. Allows for SMS notifications upon availability of funds
54 55 56 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 54 def mobile_number @mobile_number end |
#notify_user ⇒ Object
Should we notify the user via email that their user has been created in the system? They will receive instructions to establish such account.
66 67 68 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 66 def notify_user @notify_user end |
#postal_code ⇒ Object
The user’s postal code.
33 34 35 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 33 def postal_code @postal_code end |
#state_province ⇒ Object
The user’s state/province.
30 31 32 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 30 def state_province @state_province end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
92 93 94 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 92 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 69 def self.attribute_map { :'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', :'notify_user' => :'notify_user' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
305 306 307 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 305 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
120 121 122 123 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 120 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 97 def self.openapi_types { :'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', :'notify_user' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 268 def ==(o) return true if self.equal?(o) self.class == o.class && 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. && notify_user == o.notify_user end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 336 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
407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 407 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
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 312 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
292 293 294 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 292 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
298 299 300 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 298 def hash [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, , notify_user].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 239 240 241 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 213 def list_invalid_properties invalid_properties = Array.new if @internal_user_id.nil? invalid_properties.push('invalid value for "internal_user_id", internal_user_id 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_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
383 384 385 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 383 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 389 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_s ⇒ String
Returns the string representation of the object
377 378 379 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 377 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
245 246 247 248 249 250 251 252 253 |
# File 'lib/masspay_ruby_sdk/models/user.rb', line 245 def valid? return false if @internal_user_id.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 |