Class: PaymentsApi::Beneficiary
- Defined in:
- lib/payments_api/models/beneficiary.rb
Overview
Beneficiary Information Object
Instance Attribute Summary collapse
-
#address ⇒ Address
Address Information.
-
#email ⇒ String
Beneficiary Email Address.
-
#name ⇒ String
Beneficiary Name.
-
#phone_number ⇒ String
Beneficiary Phone Number.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(name = nil, address = nil, email = nil, phone_number = nil) ⇒ Beneficiary
constructor
A new instance of Beneficiary.
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, address = nil, email = nil, phone_number = nil) ⇒ Beneficiary
Returns a new instance of Beneficiary.
35 36 37 38 39 40 41 42 43 |
# File 'lib/payments_api/models/beneficiary.rb', line 35 def initialize(name = nil, address = nil, email = nil, phone_number = nil) @name = name @address = address @email = email @phone_number = phone_number end |
Instance Attribute Details
#address ⇒ Address
Address Information
15 16 17 |
# File 'lib/payments_api/models/beneficiary.rb', line 15 def address @address end |
#email ⇒ String
Beneficiary Email Address
19 20 21 |
# File 'lib/payments_api/models/beneficiary.rb', line 19 def email @email end |
#name ⇒ String
Beneficiary Name
11 12 13 |
# File 'lib/payments_api/models/beneficiary.rb', line 11 def name @name end |
#phone_number ⇒ String
Beneficiary Phone Number
23 24 25 |
# File 'lib/payments_api/models/beneficiary.rb', line 23 def phone_number @phone_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/payments_api/models/beneficiary.rb', line 46 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash['name'] address = Address.from_hash(hash['address']) if hash['address'] email = hash['email'] phone_number = hash['phoneNumber'] # Create object from extracted values. Beneficiary.new(name, address, email, phone_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 33 |
# File 'lib/payments_api/models/beneficiary.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['address'] = 'address' @_hash['email'] = 'email' @_hash['phone_number'] = 'phoneNumber' @_hash end |