Class: TransferZero::Sender
- Inherits:
-
Object
- Object
- TransferZero::Sender
- Defined in:
- lib/transferzero-sdk/models/sender.rb
Overview
This contains the details of the sender. The first time a specific sender is used the full details should be provided. Once a sender is created and is used, the next time you MUST only send the ID of the sender. This is so we can match the same sender across multiple transactions for KYC and audit purposes. Personal Sender Example: “‘json { "country": "UG", "phone_country": "UG", "phone_number": "752403639", "email": "[email protected]", "first_name": "Johnny", "last_name": "English", "city": "Kampala", "street": "Unknown 17-3", "address_description": "Description of address", "postal_code": "798983", "birth_date": "1900-12-31", "documents": [ ], "ip": "127.0.0.1", "external_id": "806ec63a-a5a7-43cc-9d75-1ee74fbcc026", "metadata": { } } “` Business Sender Example: “`json { "type": "business", "country": "UG", "phone_country": "UG", "phone_number": "752403639", "email": "[email protected]", "name": "MyCompany", "city": "Kampala", "street": "Unknown 17-3", "postal_code": "798983", "address_description": "Description of address", "documents": [ ], "ip": "127.0.0.1", "external_id": "806ec63a-a5a7-43cc-9d75-1ee74fbcc026", "metadata": { } } “` [Sender in the API documentation](github.com/transferzero/api-documentation/blob/master/transaction-flow.md#sender)
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#address ⇒ Object
The address of the sender.
-
#address_description ⇒ Object
Description of address.
-
#birth_date ⇒ Object
Date of birth of sender.
-
#city ⇒ Object
Sender’s city.
-
#country ⇒ Object
Country of sender in 2-character alpha ISO 3166-2 country format.
-
#description ⇒ Object
Description of the sender.
-
#documents ⇒ Object
Needed for KYC checks.
-
#email ⇒ Object
Email of sender.
-
#errors ⇒ Object
The fields that have some problems and don’t pass validation.
-
#external_id ⇒ Object
Optional ID that is supplied by partner linking it to the partner’s own Sender ID.
-
#first_name ⇒ Object
First name of sender (used only with a Personal sender).
-
#id ⇒ Object
Returns the value of attribute id.
-
#ip ⇒ Object
IP of sender.
-
#last_name ⇒ Object
Last name of sender (used only with a Personal sender).
-
#metadata ⇒ Object
Metadata of sender.
-
#middle_name ⇒ Object
Middle name of sender (used only with a Personal sender).
-
#name ⇒ Object
Name of sender (used only with a Business sender).
-
#nationality ⇒ Object
The nationality of the sender (used only with a Personal sender).
-
#occupation ⇒ Object
Occupation of sender (used only with a Personal sender).
-
#onboarding_status ⇒ Object
The onboarding status of the sender.
-
#phone_country ⇒ Object
Phone country of sender in 2-character alpha ISO 3166-2 country format.
-
#phone_number ⇒ Object
Phone number of sender (without country callcode).
-
#postal_code ⇒ Object
Zip code of sender.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street ⇒ Object
Sender’s street.
-
#type ⇒ Object
Type of sender to create - either person or business (defaults to person).
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #[](key) ⇒ Object
-
#_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
Returns the model itself.
- #dig(*args) ⇒ Object
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Sender
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 = {}) ⇒ Sender
Initializes the object
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 239 240 241 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 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/transferzero-sdk/models/sender.rb', line 182 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::Sender` 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 `TransferZero::Sender`. 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?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'country') self.country = attributes[:'country'] end if attributes.key?(:'phone_country') self.phone_country = attributes[:'phone_country'] end if attributes.key?(:'phone_number') self.phone_number = attributes[:'phone_number'] end if attributes.key?(:'email') self.email = attributes[:'email'] 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?(:'occupation') self.occupation = attributes[:'occupation'] end if attributes.key?(:'nationality') self.nationality = attributes[:'nationality'] end if attributes.key?(:'onboarding_status') self.onboarding_status = attributes[:'onboarding_status'] end if attributes.key?(:'address') self.address = attributes[:'address'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'city') self.city = attributes[:'city'] end if attributes.key?(:'street') self.street = attributes[:'street'] end if attributes.key?(:'address_description') self.address_description = attributes[:'address_description'] end if attributes.key?(:'postal_code') self.postal_code = attributes[:'postal_code'] end if attributes.key?(:'birth_date') self.birth_date = attributes[:'birth_date'] end if attributes.key?(:'ip') self.ip = attributes[:'ip'] end if attributes.key?(:'documents') if (value = attributes[:'documents']).is_a?(Array) self.documents = value end end if attributes.key?(:'metadata') self. = attributes[:'metadata'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'external_id') self.external_id = attributes[:'external_id'] end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Hash) self.errors = value end end end |
Instance Attribute Details
#address ⇒ Object
The address of the sender
52 53 54 |
# File 'lib/transferzero-sdk/models/sender.rb', line 52 def address @address end |
#address_description ⇒ Object
Description of address
67 68 69 |
# File 'lib/transferzero-sdk/models/sender.rb', line 67 def address_description @address_description end |
#birth_date ⇒ Object
Date of birth of sender
73 74 75 |
# File 'lib/transferzero-sdk/models/sender.rb', line 73 def birth_date @birth_date end |
#city ⇒ Object
Sender’s city
61 62 63 |
# File 'lib/transferzero-sdk/models/sender.rb', line 61 def city @city end |
#country ⇒ Object
Country of sender in 2-character alpha ISO 3166-2 country format
22 23 24 |
# File 'lib/transferzero-sdk/models/sender.rb', line 22 def country @country end |
#description ⇒ Object
Description of the sender
55 56 57 |
# File 'lib/transferzero-sdk/models/sender.rb', line 55 def description @description end |
#documents ⇒ Object
Needed for KYC checks. Required to approve the sender unless KYC is waived for your account. Please send us an empty list of documents: ‘"documents": [ ]` in the request if KYC has been waived. If the documents already exist, please send the Document ID eg. “`JSON "documents": [ { "id": "b6648ba3-1c7b-4f59-8580-684899c84a07" } ] “`
79 80 81 |
# File 'lib/transferzero-sdk/models/sender.rb', line 79 def documents @documents end |
#email ⇒ Object
Email of sender
31 32 33 |
# File 'lib/transferzero-sdk/models/sender.rb', line 31 def email @email end |
#errors ⇒ Object
The fields that have some problems and don’t pass validation
92 93 94 |
# File 'lib/transferzero-sdk/models/sender.rb', line 92 def errors @errors end |
#external_id ⇒ Object
Optional ID that is supplied by partner linking it to the partner’s own Sender ID. Note: if present we will validate whether the sent ID is a duplicate in our system or not.
89 90 91 |
# File 'lib/transferzero-sdk/models/sender.rb', line 89 def external_id @external_id end |
#first_name ⇒ Object
First name of sender (used only with a Personal sender)
34 35 36 |
# File 'lib/transferzero-sdk/models/sender.rb', line 34 def first_name @first_name end |
#id ⇒ Object
Returns the value of attribute id.
86 87 88 |
# File 'lib/transferzero-sdk/models/sender.rb', line 86 def id @id end |
#ip ⇒ Object
IP of sender
76 77 78 |
# File 'lib/transferzero-sdk/models/sender.rb', line 76 def ip @ip end |
#last_name ⇒ Object
Last name of sender (used only with a Personal sender)
40 41 42 |
# File 'lib/transferzero-sdk/models/sender.rb', line 40 def last_name @last_name end |
#metadata ⇒ Object
Metadata of sender. You can store any detail specific to your integration here (for example the local ID of the sender on your end). When requesting sender details you will receive the sent metadata back. Also when sending sender related webhooks you will receive the details stored here as well.
82 83 84 |
# File 'lib/transferzero-sdk/models/sender.rb', line 82 def @metadata end |
#middle_name ⇒ Object
Middle name of sender (used only with a Personal sender)
37 38 39 |
# File 'lib/transferzero-sdk/models/sender.rb', line 37 def middle_name @middle_name end |
#name ⇒ Object
Name of sender (used only with a Business sender)
58 59 60 |
# File 'lib/transferzero-sdk/models/sender.rb', line 58 def name @name end |
#nationality ⇒ Object
The nationality of the sender (used only with a Personal sender)
46 47 48 |
# File 'lib/transferzero-sdk/models/sender.rb', line 46 def nationality @nationality end |
#occupation ⇒ Object
Occupation of sender (used only with a Personal sender)
43 44 45 |
# File 'lib/transferzero-sdk/models/sender.rb', line 43 def occupation @occupation end |
#onboarding_status ⇒ Object
The onboarding status of the sender
49 50 51 |
# File 'lib/transferzero-sdk/models/sender.rb', line 49 def onboarding_status @onboarding_status end |
#phone_country ⇒ Object
Phone country of sender in 2-character alpha ISO 3166-2 country format
25 26 27 |
# File 'lib/transferzero-sdk/models/sender.rb', line 25 def phone_country @phone_country end |
#phone_number ⇒ Object
Phone number of sender (without country callcode)
28 29 30 |
# File 'lib/transferzero-sdk/models/sender.rb', line 28 def phone_number @phone_number end |
#postal_code ⇒ Object
Zip code of sender
70 71 72 |
# File 'lib/transferzero-sdk/models/sender.rb', line 70 def postal_code @postal_code end |
#state ⇒ Object
Returns the value of attribute state.
84 85 86 |
# File 'lib/transferzero-sdk/models/sender.rb', line 84 def state @state end |
#street ⇒ Object
Sender’s street
64 65 66 |
# File 'lib/transferzero-sdk/models/sender.rb', line 64 def street @street end |
#type ⇒ Object
Type of sender to create - either person or business (defaults to person)
19 20 21 |
# File 'lib/transferzero-sdk/models/sender.rb', line 19 def type @type end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/transferzero-sdk/models/sender.rb', line 117 def self.attribute_map { :'type' => :'type', :'country' => :'country', :'phone_country' => :'phone_country', :'phone_number' => :'phone_number', :'email' => :'email', :'first_name' => :'first_name', :'middle_name' => :'middle_name', :'last_name' => :'last_name', :'occupation' => :'occupation', :'nationality' => :'nationality', :'onboarding_status' => :'onboarding_status', :'address' => :'address', :'description' => :'description', :'name' => :'name', :'city' => :'city', :'street' => :'street', :'address_description' => :'address_description', :'postal_code' => :'postal_code', :'birth_date' => :'birth_date', :'ip' => :'ip', :'documents' => :'documents', :'metadata' => :'metadata', :'state' => :'state', :'id' => :'id', :'external_id' => :'external_id', :'errors' => :'errors' } end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/transferzero-sdk/models/sender.rb', line 149 def self.openapi_types { :'type' => :'String', :'country' => :'String', :'phone_country' => :'String', :'phone_number' => :'String', :'email' => :'String', :'first_name' => :'String', :'middle_name' => :'String', :'last_name' => :'String', :'occupation' => :'String', :'nationality' => :'String', :'onboarding_status' => :'String', :'address' => :'String', :'description' => :'String', :'name' => :'String', :'city' => :'String', :'street' => :'String', :'address_description' => :'String', :'postal_code' => :'String', :'birth_date' => :'Date', :'ip' => :'String', :'documents' => :'Array<Document>', :'metadata' => :'Object', :'state' => :'SenderState', :'id' => :'String', :'external_id' => :'String', :'errors' => :'Hash<String, Array<ValidationErrorDescription>>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/transferzero-sdk/models/sender.rb', line 371 def ==(o) return true if self.equal?(o) self.class == o.class && type == o.type && country == o.country && phone_country == o.phone_country && phone_number == o.phone_number && email == o.email && first_name == o.first_name && middle_name == o.middle_name && last_name == o.last_name && occupation == o.occupation && nationality == o.nationality && onboarding_status == o.onboarding_status && address == o.address && description == o.description && name == o.name && city == o.city && street == o.street && address_description == o.address_description && postal_code == o.postal_code && birth_date == o.birth_date && ip == o.ip && documents == o.documents && == o. && state == o.state && id == o.id && external_id == o.external_id && errors == o.errors end |
#[](key) ⇒ Object
502 503 504 |
# File 'lib/transferzero-sdk/models/sender.rb', line 502 def [](key) to_hash[key] end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
# File 'lib/transferzero-sdk/models/sender.rb', line 440 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.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 temp_model = TransferZero.const_get(type).new temp_model.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
514 515 516 517 518 519 520 521 522 523 524 525 526 |
# File 'lib/transferzero-sdk/models/sender.rb', line 514 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
Returns the model itself
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/transferzero-sdk/models/sender.rb', line 419 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#dig(*args) ⇒ Object
506 507 508 |
# File 'lib/transferzero-sdk/models/sender.rb', line 506 def dig(*args) to_hash.dig(*args) end |
#eql?(o) ⇒ Boolean
404 405 406 |
# File 'lib/transferzero-sdk/models/sender.rb', line 404 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
410 411 412 |
# File 'lib/transferzero-sdk/models/sender.rb', line 410 def hash [type, country, phone_country, phone_number, email, first_name, middle_name, last_name, occupation, nationality, onboarding_status, address, description, name, city, street, address_description, postal_code, birth_date, ip, documents, , state, id, external_id, errors].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/transferzero-sdk/models/sender.rb', line 306 def list_invalid_properties invalid_properties = Array.new if @country.nil? invalid_properties.push('invalid value for "country", country cannot be nil.') end if @phone_country.nil? invalid_properties.push('invalid value for "phone_country", phone_country cannot be nil.') end if @email.nil? invalid_properties.push('invalid value for "email", email cannot be nil.') end if @city.nil? invalid_properties.push('invalid value for "city", city cannot be nil.') end if @street.nil? invalid_properties.push('invalid value for "street", street cannot be nil.') end if @postal_code.nil? invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.') end if @ip.nil? invalid_properties.push('invalid value for "ip", ip cannot be nil.') end if @documents.nil? invalid_properties.push('invalid value for "documents", documents cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
486 487 488 |
# File 'lib/transferzero-sdk/models/sender.rb', line 486 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
492 493 494 495 496 497 498 499 500 |
# File 'lib/transferzero-sdk/models/sender.rb', line 492 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end ::ActiveSupport::HashWithIndifferentAccess.new(hash) end |
#to_s ⇒ String
Returns the string representation of the object
480 481 482 |
# File 'lib/transferzero-sdk/models/sender.rb', line 480 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/transferzero-sdk/models/sender.rb', line 345 def valid? type_validator = EnumAttributeValidator.new('String', ["person", "business"]) return false unless type_validator.valid?(@type) return false if @country.nil? return false if @phone_country.nil? return false if @email.nil? return false if @city.nil? return false if @street.nil? return false if @postal_code.nil? return false if @ip.nil? return false if @documents.nil? true end |