transferzero-sdk 1.5.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -5
  3. data/docs/Currency.md +0 -2
  4. data/docs/CurrencyExchange.md +0 -2
  5. data/docs/CurrencyOpposite.md +3 -3
  6. data/docs/Document.md +3 -3
  7. data/docs/DocumentsApi.md +2 -74
  8. data/docs/PayinMethodDetails.md +3 -1
  9. data/docs/PayinMethodDetailsBTC.md +17 -0
  10. data/docs/PayoutMethod.md +1 -1
  11. data/docs/PayoutMethodDetails.md +17 -1
  12. data/docs/PayoutMethodDetailsBTC.md +23 -0
  13. data/docs/PayoutMethodDetailsGBPBank.md +29 -0
  14. data/docs/PayoutMethodDetailsIBAN.md +1 -1
  15. data/docs/PayoutMethodDetailsMobile.md +3 -1
  16. data/docs/PayoutMethodDetailsZARBank.md +35 -0
  17. data/docs/PoliticallyExposedPerson.md +31 -0
  18. data/docs/Recipient.md +1 -1
  19. data/docs/RecipientsApi.md +1 -1
  20. data/docs/Sender.md +72 -32
  21. data/docs/Transaction.md +3 -3
  22. data/lib/transferzero-sdk.rb +5 -0
  23. data/lib/transferzero-sdk/api/documents_api.rb +0 -63
  24. data/lib/transferzero-sdk/api/recipients_api.rb +2 -2
  25. data/lib/transferzero-sdk/api_client.rb +5 -3
  26. data/lib/transferzero-sdk/models/account.rb +70 -69
  27. data/lib/transferzero-sdk/models/account_list_response.rb +67 -66
  28. data/lib/transferzero-sdk/models/account_meta.rb +61 -60
  29. data/lib/transferzero-sdk/models/account_response.rb +66 -65
  30. data/lib/transferzero-sdk/models/account_validation_error.rb +61 -60
  31. data/lib/transferzero-sdk/models/account_validation_request.rb +164 -163
  32. data/lib/transferzero-sdk/models/account_validation_response.rb +66 -65
  33. data/lib/transferzero-sdk/models/account_validation_result.rb +61 -60
  34. data/lib/transferzero-sdk/models/api_log.rb +136 -135
  35. data/lib/transferzero-sdk/models/api_log_list_response.rb +70 -69
  36. data/lib/transferzero-sdk/models/api_log_response.rb +60 -59
  37. data/lib/transferzero-sdk/models/currency.rb +133 -142
  38. data/lib/transferzero-sdk/models/currency_exchange.rb +149 -158
  39. data/lib/transferzero-sdk/models/currency_exchange_list_response.rb +62 -61
  40. data/lib/transferzero-sdk/models/currency_list_response.rb +62 -61
  41. data/lib/transferzero-sdk/models/currency_opposite.rb +166 -165
  42. data/lib/transferzero-sdk/models/debit.rb +151 -150
  43. data/lib/transferzero-sdk/models/debit_list_request.rb +61 -60
  44. data/lib/transferzero-sdk/models/debit_list_response.rb +67 -66
  45. data/lib/transferzero-sdk/models/debit_request.rb +60 -59
  46. data/lib/transferzero-sdk/models/debit_request_wrapper.rb +80 -79
  47. data/lib/transferzero-sdk/models/debit_response.rb +60 -59
  48. data/lib/transferzero-sdk/models/document.rb +179 -177
  49. data/lib/transferzero-sdk/models/document_list_response.rb +67 -66
  50. data/lib/transferzero-sdk/models/document_request.rb +60 -59
  51. data/lib/transferzero-sdk/models/document_response.rb +60 -59
  52. data/lib/transferzero-sdk/models/document_webhook.rb +96 -95
  53. data/lib/transferzero-sdk/models/error_status.rb +66 -65
  54. data/lib/transferzero-sdk/models/field_description.rb +95 -94
  55. data/lib/transferzero-sdk/models/field_select_validation.rb +70 -69
  56. data/lib/transferzero-sdk/models/field_validation.rb +78 -77
  57. data/lib/transferzero-sdk/models/pagination.rb +97 -96
  58. data/lib/transferzero-sdk/models/pagination_meta.rb +60 -59
  59. data/lib/transferzero-sdk/models/payin_method.rb +97 -96
  60. data/lib/transferzero-sdk/models/payin_method_details.rb +122 -110
  61. data/lib/transferzero-sdk/models/payin_method_details_btc.rb +204 -0
  62. data/lib/transferzero-sdk/models/payin_method_details_mobile.rb +75 -74
  63. data/lib/transferzero-sdk/models/payin_method_details_ngn_bank.rb +71 -70
  64. data/lib/transferzero-sdk/models/payin_method_request.rb +60 -59
  65. data/lib/transferzero-sdk/models/payment_method.rb +109 -108
  66. data/lib/transferzero-sdk/models/payment_method_list_response.rb +61 -60
  67. data/lib/transferzero-sdk/models/payment_method_opposite.rb +124 -123
  68. data/lib/transferzero-sdk/models/payout_method.rb +107 -106
  69. data/lib/transferzero-sdk/models/payout_method_bank_account_type_enum.rb +14 -19
  70. data/lib/transferzero-sdk/models/payout_method_details.rb +398 -297
  71. data/lib/transferzero-sdk/models/payout_method_details_balance.rb +61 -60
  72. data/lib/transferzero-sdk/models/payout_method_details_btc.rb +250 -0
  73. data/lib/transferzero-sdk/models/payout_method_details_gbp_bank.rb +267 -0
  74. data/lib/transferzero-sdk/models/payout_method_details_ghs_bank.rb +97 -96
  75. data/lib/transferzero-sdk/models/payout_method_details_iban.rb +100 -104
  76. data/lib/transferzero-sdk/models/payout_method_details_mad_cash.rb +162 -161
  77. data/lib/transferzero-sdk/models/payout_method_details_mobile.rb +93 -83
  78. data/lib/transferzero-sdk/models/payout_method_details_ngn_bank.rb +104 -103
  79. data/lib/transferzero-sdk/models/payout_method_details_xof_bank.rb +108 -107
  80. data/lib/transferzero-sdk/models/payout_method_details_xof_mobile.rb +97 -96
  81. data/lib/transferzero-sdk/models/payout_method_details_zar_bank.rb +324 -0
  82. data/lib/transferzero-sdk/models/payout_method_gender_enum.rb +14 -19
  83. data/lib/transferzero-sdk/models/payout_method_identity_card_type_enum.rb +15 -20
  84. data/lib/transferzero-sdk/models/payout_method_list_response.rb +67 -66
  85. data/lib/transferzero-sdk/models/payout_method_mobile_provider_enum.rb +17 -19
  86. data/lib/transferzero-sdk/models/payout_method_request.rb +60 -59
  87. data/lib/transferzero-sdk/models/payout_method_response.rb +60 -59
  88. data/lib/transferzero-sdk/models/payout_method_webhook.rb +96 -95
  89. data/lib/transferzero-sdk/models/politically_exposed_person.rb +272 -0
  90. data/lib/transferzero-sdk/models/recipient.rb +230 -229
  91. data/lib/transferzero-sdk/models/recipient_list_response.rb +67 -66
  92. data/lib/transferzero-sdk/models/recipient_request.rb +60 -59
  93. data/lib/transferzero-sdk/models/recipient_response.rb +60 -59
  94. data/lib/transferzero-sdk/models/recipient_state.rb +22 -27
  95. data/lib/transferzero-sdk/models/recipient_webhook.rb +96 -95
  96. data/lib/transferzero-sdk/models/sender.rb +587 -348
  97. data/lib/transferzero-sdk/models/sender_list_response.rb +67 -66
  98. data/lib/transferzero-sdk/models/sender_request.rb +60 -59
  99. data/lib/transferzero-sdk/models/sender_response.rb +66 -65
  100. data/lib/transferzero-sdk/models/sender_response_existing.rb +60 -59
  101. data/lib/transferzero-sdk/models/sender_response_meta.rb +60 -59
  102. data/lib/transferzero-sdk/models/sender_state.rb +19 -24
  103. data/lib/transferzero-sdk/models/sender_webhook.rb +96 -95
  104. data/lib/transferzero-sdk/models/transaction.rb +192 -191
  105. data/lib/transferzero-sdk/models/transaction_list_response.rb +67 -66
  106. data/lib/transferzero-sdk/models/transaction_request.rb +60 -59
  107. data/lib/transferzero-sdk/models/transaction_response.rb +66 -65
  108. data/lib/transferzero-sdk/models/transaction_response_existing.rb +66 -65
  109. data/lib/transferzero-sdk/models/transaction_response_meta.rb +60 -59
  110. data/lib/transferzero-sdk/models/transaction_state.rb +23 -28
  111. data/lib/transferzero-sdk/models/transaction_traits.rb +71 -70
  112. data/lib/transferzero-sdk/models/transaction_webhook.rb +96 -95
  113. data/lib/transferzero-sdk/models/validation_error_description.rb +62 -61
  114. data/lib/transferzero-sdk/models/webhook.rb +92 -91
  115. data/lib/transferzero-sdk/models/webhook_definition.rb +107 -106
  116. data/lib/transferzero-sdk/models/webhook_definition_event_list_response.rb +61 -60
  117. data/lib/transferzero-sdk/models/webhook_definition_list_response.rb +67 -66
  118. data/lib/transferzero-sdk/models/webhook_definition_request.rb +60 -59
  119. data/lib/transferzero-sdk/models/webhook_definition_response.rb +60 -59
  120. data/lib/transferzero-sdk/models/webhook_log.rb +97 -96
  121. data/lib/transferzero-sdk/models/webhook_log_list_response.rb +70 -69
  122. data/lib/transferzero-sdk/models/webhook_log_metadata.rb +129 -128
  123. data/lib/transferzero-sdk/models/webhook_log_metadata_request.rb +80 -79
  124. data/lib/transferzero-sdk/models/webhook_log_metadata_response.rb +81 -80
  125. data/lib/transferzero-sdk/models/webhook_log_response.rb +60 -59
  126. data/lib/transferzero-sdk/version.rb +1 -1
  127. data/spec/models/payin_method_details_btc_spec.rb +41 -0
  128. data/spec/models/payout_method_details_btc_spec.rb +59 -0
  129. data/spec/models/payout_method_details_gbp_bank_spec.rb +77 -0
  130. data/spec/models/payout_method_details_zar_bank_spec.rb +89 -0
  131. data/spec/models/politically_exposed_person_spec.rb +83 -0
  132. metadata +32 -13
  133. data/transferzero-sdk-1.4.0.gem +0 -0
@@ -13,118 +13,118 @@ OpenAPI Generator version: 4.0.0-beta3
13
13
  require 'date'
14
14
 
15
15
  module TransferZero
16
- class PayoutMethodWebhook
17
- # The ID of the webhook that was used to send out this callback
18
- attr_accessor :webhook
19
-
20
- # The event that triggered this webhook
21
- attr_accessor :event
22
-
23
- attr_accessor :object
24
-
25
- # Attribute mapping from ruby-style variable name to JSON key.
26
- def self.attribute_map
27
- {
28
- :'webhook' => :'webhook',
29
- :'event' => :'event',
30
- :'object' => :'object'
31
- }
32
- end
33
-
34
- # Attribute type mapping.
35
- def self.openapi_types
36
- {
37
- :'webhook' => :'String',
38
- :'event' => :'String',
39
- :'object' => :'PayoutMethod'
40
- }
41
- end
42
-
43
- # List of class defined in allOf (OpenAPI v3)
44
- def self.openapi_all_of
45
- [
46
- :'Webhook'
47
- ]
48
- end
49
-
50
- # Initializes the object
51
- # @param [Hash] attributes Model attributes in the form of hash
52
- def initialize(attributes = {})
53
- if (!attributes.is_a?(Hash))
54
- fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodWebhook` initialize method"
55
- end
56
-
57
- # check to see if the attribute exists and convert string to symbol for hash key
58
- attributes = attributes.each_with_object({}) { |(k, v), h|
59
- if (!self.class.attribute_map.key?(k.to_sym))
60
- fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
- end
62
- h[k.to_sym] = v
63
- }
16
+ class PayoutMethodWebhook
17
+ # The ID of the webhook that was used to send out this callback
18
+ attr_accessor :webhook
19
+
20
+ # The event that triggered this webhook
21
+ attr_accessor :event
22
+
23
+ attr_accessor :object
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'webhook' => :'webhook',
29
+ :'event' => :'event',
30
+ :'object' => :'object'
31
+ }
32
+ end
64
33
 
65
- if attributes.key?(:'webhook')
66
- self.webhook = attributes[:'webhook']
67
- end
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'webhook' => :'String',
38
+ :'event' => :'String',
39
+ :'object' => :'PayoutMethod'
40
+ }
41
+ end
68
42
 
69
- if attributes.key?(:'event')
70
- self.event = attributes[:'event']
71
- end
43
+ # List of class defined in allOf (OpenAPI v3)
44
+ def self.openapi_all_of
45
+ [
46
+ :'Webhook'
47
+ ]
48
+ end
72
49
 
73
- if attributes.key?(:'object')
74
- self.object = attributes[:'object']
75
- end
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodWebhook` initialize method"
76
55
  end
77
56
 
78
- # Show invalid properties with the reasons. Usually used together with valid?
79
- # @return Array for valid properties with the reasons
80
- def list_invalid_properties
81
- invalid_properties = Array.new
82
- if @webhook.nil?
83
- invalid_properties.push('invalid value for "webhook", webhook cannot be nil.')
84
- end
85
-
86
- if @event.nil?
87
- invalid_properties.push('invalid value for "event", event cannot be nil.')
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
61
  end
62
+ h[k.to_sym] = v
63
+ }
89
64
 
90
- if @object.nil?
91
- invalid_properties.push('invalid value for "object", object cannot be nil.')
92
- end
65
+ if attributes.key?(:'webhook')
66
+ self.webhook = attributes[:'webhook']
67
+ end
93
68
 
94
- invalid_properties
69
+ if attributes.key?(:'event')
70
+ self.event = attributes[:'event']
95
71
  end
96
72
 
97
- # Check to see if the all the properties in the model are valid
98
- # @return true if the model is valid
99
- def valid?
100
- return false if @webhook.nil?
101
- return false if @event.nil?
102
- return false if @object.nil?
103
- true
73
+ if attributes.key?(:'object')
74
+ self.object = attributes[:'object']
104
75
  end
76
+ end
105
77
 
106
- # Checks equality by comparing each attribute.
107
- # @param [Object] Object to be compared
108
- def ==(o)
109
- return true if self.equal?(o)
110
- self.class == o.class &&
111
- webhook == o.webhook &&
112
- event == o.event &&
113
- object == o.object
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if @webhook.nil?
83
+ invalid_properties.push('invalid value for "webhook", webhook cannot be nil.')
114
84
  end
115
85
 
116
- # @see the `==` method
117
- # @param [Object] Object to be compared
118
- def eql?(o)
119
- self == o
86
+ if @event.nil?
87
+ invalid_properties.push('invalid value for "event", event cannot be nil.')
120
88
  end
121
89
 
122
- # Calculates hash code according to all attributes.
123
- # @return [Integer] Hash code
124
- def hash
125
- [webhook, event, object].hash
90
+ if @object.nil?
91
+ invalid_properties.push('invalid value for "object", object cannot be nil.')
126
92
  end
127
93
 
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if @webhook.nil?
101
+ return false if @event.nil?
102
+ return false if @object.nil?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ webhook == o.webhook &&
112
+ event == o.event &&
113
+ object == o.object
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Integer] Hash code
124
+ def hash
125
+ [webhook, event, object].hash
126
+ end
127
+
128
128
  require 'active_support/core_ext/hash'
129
129
  require 'active_support/hash_with_indifferent_access.rb'
130
130
  # Builds the object from hash
@@ -239,5 +239,6 @@ def _to_hash(value)
239
239
  end
240
240
  end
241
241
 
242
- end
242
+ end
243
+
243
244
  end
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TransferZero
16
+ class PoliticallyExposedPerson
17
+ attr_accessor :id
18
+
19
+ # Full name of the politically exposed person
20
+ attr_accessor :name
21
+
22
+ # The office held by the politically exposed person
23
+ attr_accessor :position
24
+
25
+ # The date on which the person started holding the office
26
+ attr_accessor :started_date
27
+
28
+ # The date on which the person ended holding the office
29
+ attr_accessor :ended_date
30
+
31
+ # The ID of the Sender to whom the person is attached to
32
+ attr_accessor :sender_id
33
+
34
+ # Date and time the person was created
35
+ attr_accessor :created_at
36
+
37
+ # Date and time the person was updated
38
+ attr_accessor :updated_at
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'id' => :'id',
44
+ :'name' => :'name',
45
+ :'position' => :'position',
46
+ :'started_date' => :'started_date',
47
+ :'ended_date' => :'ended_date',
48
+ :'sender_id' => :'sender_id',
49
+ :'created_at' => :'created_at',
50
+ :'updated_at' => :'updated_at'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'id' => :'Integer',
58
+ :'name' => :'String',
59
+ :'position' => :'String',
60
+ :'started_date' => :'DateTime',
61
+ :'ended_date' => :'DateTime',
62
+ :'sender_id' => :'String',
63
+ :'created_at' => :'DateTime',
64
+ :'updated_at' => :'DateTime'
65
+ }
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PoliticallyExposedPerson` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PoliticallyExposedPerson`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'id')
84
+ self.id = attributes[:'id']
85
+ end
86
+
87
+ if attributes.key?(:'name')
88
+ self.name = attributes[:'name']
89
+ end
90
+
91
+ if attributes.key?(:'position')
92
+ self.position = attributes[:'position']
93
+ end
94
+
95
+ if attributes.key?(:'started_date')
96
+ self.started_date = attributes[:'started_date']
97
+ end
98
+
99
+ if attributes.key?(:'ended_date')
100
+ self.ended_date = attributes[:'ended_date']
101
+ end
102
+
103
+ if attributes.key?(:'sender_id')
104
+ self.sender_id = attributes[:'sender_id']
105
+ end
106
+
107
+ if attributes.key?(:'created_at')
108
+ self.created_at = attributes[:'created_at']
109
+ end
110
+
111
+ if attributes.key?(:'updated_at')
112
+ self.updated_at = attributes[:'updated_at']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ true
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ id == o.id &&
135
+ name == o.name &&
136
+ position == o.position &&
137
+ started_date == o.started_date &&
138
+ ended_date == o.ended_date &&
139
+ sender_id == o.sender_id &&
140
+ created_at == o.created_at &&
141
+ updated_at == o.updated_at
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [id, name, position, started_date, ended_date, sender_id, created_at, updated_at].hash
154
+ end
155
+
156
+ require 'active_support/core_ext/hash'
157
+ require 'active_support/hash_with_indifferent_access.rb'
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ self.class.openapi_types.each_pair do |key, type|
164
+ if type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
168
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
169
+ end
170
+ elsif !attributes[self.class.attribute_map[key]].nil?
171
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
172
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
173
+ end
174
+
175
+ self
176
+ end
177
+
178
+ # Deserializes the data based on type
179
+ # @param string type Data type
180
+ # @param string value Value to be deserialized
181
+ # @return [Object] Deserialized data
182
+ def _deserialize(type, value)
183
+ case type.to_sym
184
+ when :DateTime
185
+ DateTime.parse(value)
186
+ when :Date
187
+ Date.parse(value)
188
+ when :String
189
+ value.to_s
190
+ when :Integer
191
+ value.to_i
192
+ when :Float
193
+ value.to_f
194
+ when :Boolean
195
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
+ true
197
+ else
198
+ false
199
+ end
200
+ when :Object
201
+ # generic object (usually a Hash), return directly
202
+ value
203
+ when /\AArray<(?<inner_type>.+)>\z/
204
+ inner_type = Regexp.last_match[:inner_type]
205
+ value.map { |v| _deserialize(inner_type, v) }
206
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
207
+ k_type = Regexp.last_match[:k_type]
208
+ v_type = Regexp.last_match[:v_type]
209
+ {}.tap do |hash|
210
+ value.each do |k, v|
211
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
212
+ end
213
+ end
214
+ else # model
215
+ temp_model = TransferZero.const_get(type).new
216
+ temp_model.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ next if value.nil?
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
242
+ end
243
+
244
+ def [](key)
245
+ to_hash[key]
246
+ end
247
+
248
+ def dig(*args)
249
+ to_hash.dig(*args)
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+
272
+ end