Class: FdxV660Api::PaymentGenericAccountEntity2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/payment_generic_account_entity2.rb

Overview

Sending account details

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(account_number: SKIP, account_type: SKIP, name: SKIP, currency_code: SKIP, id: SKIP, branch: SKIP, additional_properties: nil) ⇒ PaymentGenericAccountEntity2

Returns a new instance of PaymentGenericAccountEntity2.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 65

def initialize(account_number: SKIP, account_type: SKIP, name: SKIP,
               currency_code: SKIP, id: SKIP, branch: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_number =  unless  == SKIP
  @account_type =  unless  == SKIP
  @name = name unless name == SKIP
  @currency_code = currency_code unless currency_code == SKIP
  @id = id unless id == SKIP
  @branch = branch unless branch == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_numberString

Unique identifier of the account number

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 14

def 
  @account_number
end

#account_typeAccountType3

Account type

Returns:



18
19
20
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 18

def 
  @account_type
end

#branchBranchEntity1

Branch details associated with this account

Returns:



34
35
36
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 34

def branch
  @branch
end

#currency_codeIso4217CurrencyCode5

ISO 4217 currency code



26
27
28
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 26

def currency_code
  @currency_code
end

#idObject

Identifier of the payment generic account

Returns:

  • (Object)


30
31
32
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 30

def id
  @id
end

#nameString

Account name

Returns:

  • (String)


22
23
24
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 22

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP
   = hash.key?('accountType') ? hash['accountType'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  currency_code = hash.key?('currencyCode') ? hash['currencyCode'] : SKIP
  id = hash.key?('id') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PaymentGenericAccountEntity2Id), hash['id']
  ) : SKIP
  branch = BranchEntity1.from_hash(hash['branch']) if hash['branch']

  # 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.
  PaymentGenericAccountEntity2.new(account_number: ,
                                   account_type: ,
                                   name: name,
                                   currency_code: currency_code,
                                   id: id,
                                   branch: branch,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_number'] = 'accountNumber'
  @_hash['account_type'] = 'accountType'
  @_hash['name'] = 'name'
  @_hash['currency_code'] = 'currencyCode'
  @_hash['id'] = 'id'
  @_hash['branch'] = 'branch'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
58
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 49

def self.optionals
  %w[
    account_number
    account_type
    name
    currency_code
    id
    branch
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



113
114
115
116
117
118
119
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 113

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
135
136
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 130

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number.inspect}, account_type:"\
  " #{@account_type.inspect}, name: #{@name.inspect}, currency_code:"\
  " #{@currency_code.inspect}, id: #{@id.inspect}, branch: #{@branch.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



122
123
124
125
126
127
# File 'lib/fdx_v660_api/models/payment_generic_account_entity2.rb', line 122

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number}, account_type: #{@account_type}, name:"\
  " #{@name}, currency_code: #{@currency_code}, id: #{@id}, branch: #{@branch},"\
  " additional_properties: #{@additional_properties}>"
end