budgea_client 5.3.8 → 5.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -10
- data/README.md +14 -4
- data/budgea_openapi.json +329 -27
- data/config.json +1 -1
- data/docs/AuthenticationApi.md +62 -0
- data/docs/Connector.md +1 -0
- data/docs/ConnectorSource.md +7 -0
- data/docs/Field.md +2 -1
- data/docs/InlineResponse2005.md +1 -3
- data/docs/PFMApi.md +9 -12
- data/docs/Payment.md +15 -0
- data/docs/PaymentBeneficiary.md +13 -0
- data/docs/PaymentBeneficiaryRequest.md +12 -0
- data/docs/PaymentData.md +13 -0
- data/docs/PaymentErrorCode.md +7 -0
- data/docs/PaymentInstruction.md +12 -0
- data/docs/PaymentInstructionRequest.md +13 -0
- data/docs/PaymentRequest.md +13 -0
- data/docs/PaymentState.md +7 -0
- data/docs/PaymentsApi.md +61 -0
- data/lib/budgea_client.rb +9 -0
- data/lib/budgea_client/api/authentication_api.rb +60 -0
- data/lib/budgea_client/api/payments_api.rb +75 -0
- data/lib/budgea_client/api/pfm_api.rb +14 -26
- data/lib/budgea_client/models/connection.rb +2 -4
- data/lib/budgea_client/models/connector.rb +15 -4
- data/lib/budgea_client/models/connector_source.rb +79 -4
- data/lib/budgea_client/models/field.rb +18 -5
- data/lib/budgea_client/models/inline_response_200_5.rb +7 -37
- data/lib/budgea_client/models/payment.rb +255 -0
- data/lib/budgea_client/models/payment_beneficiary.rb +235 -0
- data/lib/budgea_client/models/payment_beneficiary_request.rb +240 -0
- data/lib/budgea_client/models/payment_data.rb +246 -0
- data/lib/budgea_client/models/payment_error_code.rb +44 -0
- data/lib/budgea_client/models/payment_instruction.rb +224 -0
- data/lib/budgea_client/models/payment_instruction_request.rb +254 -0
- data/lib/budgea_client/models/payment_request.rb +246 -0
- data/lib/budgea_client/models/payment_state.rb +35 -0
- data/lib/budgea_client/version.rb +1 -1
- data/spec/api/payments_api_spec.rb +46 -0
- data/spec/models/payment_beneficiary_request_spec.rb +65 -0
- data/spec/models/payment_beneficiary_spec.rb +35 -0
- data/spec/models/payment_data_spec.rb +71 -0
- data/spec/models/payment_error_code_spec.rb +35 -0
- data/spec/models/payment_instruction_request_spec.rb +35 -0
- data/spec/models/payment_instruction_spec.rb +35 -0
- data/spec/models/payment_request_spec.rb +71 -0
- data/spec/models/payment_spec.rb +35 -0
- data/spec/models/payment_state_spec.rb +35 -0
- metadata +42 -3
- data/pkg/budgea_client-5.3.7.gem +0 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
=begin
|
2
|
+
#Budgea API Documentation
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.19
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module BudgeaClient
|
16
|
+
class PaymentErrorCode
|
17
|
+
|
18
|
+
INVALID_EMITTER = 'invalidEmitter'.freeze
|
19
|
+
INSUFFICIENT_FUNDS = 'insufficientFunds'.freeze
|
20
|
+
INVALID_AMOUNT = 'invalidAmount'.freeze
|
21
|
+
INVALID_CURRENCY = 'invalidCurrency'.freeze
|
22
|
+
INVALID_DATE = 'invalidDate'.freeze
|
23
|
+
INVALID_BENEFICIARY = 'invalidBeneficiary'.freeze
|
24
|
+
INVALID_LABEL = 'invalidLabel'.freeze
|
25
|
+
REGULATORY_REASON = 'regulatoryReason'.freeze
|
26
|
+
AUTHENTICATION_FAILED = 'authenticationFailed'.freeze
|
27
|
+
NO_ANSWER_FROM_CUSTOMER = 'noAnswerFromCustomer'.freeze
|
28
|
+
NO_SPECIFIED_REASON = 'noSpecifiedReason'.freeze
|
29
|
+
CANCELLED_BY_USER = 'CancelledByUser'.freeze
|
30
|
+
BANK_MESSAGE = 'bankMessage'.freeze
|
31
|
+
INVALID_VALUE = 'invalidValue'.freeze
|
32
|
+
ACTION_NEEDED = 'actionNeeded'.freeze
|
33
|
+
BUG = 'bug'.freeze
|
34
|
+
|
35
|
+
# Builds the enum from string
|
36
|
+
# @param [String] The enum value in the form of the string
|
37
|
+
# @return [String] The enum value
|
38
|
+
def build_from_hash(value)
|
39
|
+
constantValues = PaymentErrorCode.constants.select { |c| PaymentErrorCode::const_get(c) == value }
|
40
|
+
raise "Invalid ENUM value #{value} for class #PaymentErrorCode" if constantValues.empty?
|
41
|
+
value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,224 @@
|
|
1
|
+
=begin
|
2
|
+
#Budgea API Documentation
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.19
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module BudgeaClient
|
16
|
+
class PaymentInstruction
|
17
|
+
# An identifier for the transaction.
|
18
|
+
attr_accessor :reference_id
|
19
|
+
|
20
|
+
# The currency of the payment amount.
|
21
|
+
attr_accessor :currency
|
22
|
+
|
23
|
+
# Label of the payment.
|
24
|
+
attr_accessor :label
|
25
|
+
|
26
|
+
# The execution date type of the payment: first_open_day for a standard banking transfer, deferred for a scheduled transfer, instant for instant payment. Other values might be supported later.
|
27
|
+
attr_accessor :execution_date_type
|
28
|
+
|
29
|
+
attr_accessor :beneficiary
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'reference_id' => :'reference_id',
|
35
|
+
:'currency' => :'currency',
|
36
|
+
:'label' => :'label',
|
37
|
+
:'execution_date_type' => :'execution_date_type',
|
38
|
+
:'beneficiary' => :'beneficiary'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.swagger_types
|
44
|
+
{
|
45
|
+
:'reference_id' => :'String',
|
46
|
+
:'currency' => :'String',
|
47
|
+
:'label' => :'String',
|
48
|
+
:'execution_date_type' => :'String',
|
49
|
+
:'beneficiary' => :'PaymentBeneficiary'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
return unless attributes.is_a?(Hash)
|
57
|
+
|
58
|
+
# convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
60
|
+
|
61
|
+
if attributes.has_key?(:'reference_id')
|
62
|
+
self.reference_id = attributes[:'reference_id']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'currency')
|
66
|
+
self.currency = attributes[:'currency']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.has_key?(:'label')
|
70
|
+
self.label = attributes[:'label']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.has_key?(:'execution_date_type')
|
74
|
+
self.execution_date_type = attributes[:'execution_date_type']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'beneficiary')
|
78
|
+
self.beneficiary = attributes[:'beneficiary']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properties with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
true
|
93
|
+
end
|
94
|
+
|
95
|
+
# Checks equality by comparing each attribute.
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def ==(o)
|
98
|
+
return true if self.equal?(o)
|
99
|
+
self.class == o.class &&
|
100
|
+
reference_id == o.reference_id &&
|
101
|
+
currency == o.currency &&
|
102
|
+
label == o.label &&
|
103
|
+
execution_date_type == o.execution_date_type &&
|
104
|
+
beneficiary == o.beneficiary
|
105
|
+
end
|
106
|
+
|
107
|
+
# @see the `==` method
|
108
|
+
# @param [Object] Object to be compared
|
109
|
+
def eql?(o)
|
110
|
+
self == o
|
111
|
+
end
|
112
|
+
|
113
|
+
# Calculates hash code according to all attributes.
|
114
|
+
# @return [Fixnum] Hash code
|
115
|
+
def hash
|
116
|
+
[reference_id, currency, label, execution_date_type, beneficiary].hash
|
117
|
+
end
|
118
|
+
|
119
|
+
# Builds the object from hash
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
# @return [Object] Returns the model itself
|
122
|
+
def build_from_hash(attributes)
|
123
|
+
return nil unless attributes.is_a?(Hash)
|
124
|
+
self.class.swagger_types.each_pair do |key, type|
|
125
|
+
if type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :DateTime
|
146
|
+
DateTime.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :BOOLEAN
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
temp_model = BudgeaClient.const_get(type).new
|
177
|
+
temp_model.build_from_hash(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the string representation of the object
|
182
|
+
# @return [String] String presentation of the object
|
183
|
+
def to_s
|
184
|
+
to_hash.to_s
|
185
|
+
end
|
186
|
+
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_body
|
190
|
+
to_hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the object in the form of hash
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_hash
|
196
|
+
hash = {}
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
198
|
+
value = self.send(attr)
|
199
|
+
next if value.nil?
|
200
|
+
hash[param] = _to_hash(value)
|
201
|
+
end
|
202
|
+
hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Outputs non-array value in the form of hash
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
207
|
+
# @param [Object] value Any valid value
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
209
|
+
def _to_hash(value)
|
210
|
+
if value.is_a?(Array)
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
212
|
+
elsif value.is_a?(Hash)
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
215
|
+
end
|
216
|
+
elsif value.respond_to? :to_hash
|
217
|
+
value.to_hash
|
218
|
+
else
|
219
|
+
value
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|
@@ -0,0 +1,254 @@
|
|
1
|
+
=begin
|
2
|
+
#Budgea API Documentation
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.19
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module BudgeaClient
|
16
|
+
class PaymentInstructionRequest
|
17
|
+
# An identifier for the transaction, set by the emitter client. If not provided, a random UUID value will be generated.
|
18
|
+
attr_accessor :reference_id
|
19
|
+
|
20
|
+
# The amount of the payment.
|
21
|
+
attr_accessor :amount
|
22
|
+
|
23
|
+
# The currency code of the payment amount, a per ISO 4217.
|
24
|
+
attr_accessor :currency
|
25
|
+
|
26
|
+
# Label of the payment.
|
27
|
+
attr_accessor :label
|
28
|
+
|
29
|
+
# The execution date type of the payment: first_open_day for a standard banking transfer, deferred for a scheduled transfer, instant for instant payment. Other values might be supported later.
|
30
|
+
attr_accessor :execution_date_type
|
31
|
+
|
32
|
+
attr_accessor :beneficiary
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'reference_id' => :'reference_id',
|
38
|
+
:'amount' => :'amount',
|
39
|
+
:'currency' => :'currency',
|
40
|
+
:'label' => :'label',
|
41
|
+
:'execution_date_type' => :'execution_date_type',
|
42
|
+
:'beneficiary' => :'beneficiary'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute type mapping.
|
47
|
+
def self.swagger_types
|
48
|
+
{
|
49
|
+
:'reference_id' => :'String',
|
50
|
+
:'amount' => :'Integer',
|
51
|
+
:'currency' => :'String',
|
52
|
+
:'label' => :'String',
|
53
|
+
:'execution_date_type' => :'String',
|
54
|
+
:'beneficiary' => :'PaymentBeneficiaryRequest'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Initializes the object
|
59
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
60
|
+
def initialize(attributes = {})
|
61
|
+
return unless attributes.is_a?(Hash)
|
62
|
+
|
63
|
+
# convert string to symbol for hash key
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
65
|
+
|
66
|
+
if attributes.has_key?(:'reference_id')
|
67
|
+
self.reference_id = attributes[:'reference_id']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'amount')
|
71
|
+
self.amount = attributes[:'amount']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'currency')
|
75
|
+
self.currency = attributes[:'currency']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'label')
|
79
|
+
self.label = attributes[:'label']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'execution_date_type')
|
83
|
+
self.execution_date_type = attributes[:'execution_date_type']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'beneficiary')
|
87
|
+
self.beneficiary = attributes[:'beneficiary']
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
invalid_properties = Array.new
|
95
|
+
if @amount.nil?
|
96
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
97
|
+
end
|
98
|
+
|
99
|
+
if @currency.nil?
|
100
|
+
invalid_properties.push('invalid value for "currency", currency cannot be nil.')
|
101
|
+
end
|
102
|
+
|
103
|
+
if @label.nil?
|
104
|
+
invalid_properties.push('invalid value for "label", label cannot be nil.')
|
105
|
+
end
|
106
|
+
|
107
|
+
if @execution_date_type.nil?
|
108
|
+
invalid_properties.push('invalid value for "execution_date_type", execution_date_type cannot be nil.')
|
109
|
+
end
|
110
|
+
|
111
|
+
invalid_properties
|
112
|
+
end
|
113
|
+
|
114
|
+
# Check to see if the all the properties in the model are valid
|
115
|
+
# @return true if the model is valid
|
116
|
+
def valid?
|
117
|
+
return false if @amount.nil?
|
118
|
+
return false if @currency.nil?
|
119
|
+
return false if @label.nil?
|
120
|
+
return false if @execution_date_type.nil?
|
121
|
+
true
|
122
|
+
end
|
123
|
+
|
124
|
+
# Checks equality by comparing each attribute.
|
125
|
+
# @param [Object] Object to be compared
|
126
|
+
def ==(o)
|
127
|
+
return true if self.equal?(o)
|
128
|
+
self.class == o.class &&
|
129
|
+
reference_id == o.reference_id &&
|
130
|
+
amount == o.amount &&
|
131
|
+
currency == o.currency &&
|
132
|
+
label == o.label &&
|
133
|
+
execution_date_type == o.execution_date_type &&
|
134
|
+
beneficiary == o.beneficiary
|
135
|
+
end
|
136
|
+
|
137
|
+
# @see the `==` method
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def eql?(o)
|
140
|
+
self == o
|
141
|
+
end
|
142
|
+
|
143
|
+
# Calculates hash code according to all attributes.
|
144
|
+
# @return [Fixnum] Hash code
|
145
|
+
def hash
|
146
|
+
[reference_id, amount, currency, label, execution_date_type, beneficiary].hash
|
147
|
+
end
|
148
|
+
|
149
|
+
# Builds the object from hash
|
150
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
151
|
+
# @return [Object] Returns the model itself
|
152
|
+
def build_from_hash(attributes)
|
153
|
+
return nil unless attributes.is_a?(Hash)
|
154
|
+
self.class.swagger_types.each_pair do |key, type|
|
155
|
+
if type =~ /\AArray<(.*)>/i
|
156
|
+
# check to ensure the input is an array given that the attribute
|
157
|
+
# is documented as an array but the input is not
|
158
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
159
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
160
|
+
end
|
161
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
162
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
163
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
164
|
+
end
|
165
|
+
|
166
|
+
self
|
167
|
+
end
|
168
|
+
|
169
|
+
# Deserializes the data based on type
|
170
|
+
# @param string type Data type
|
171
|
+
# @param string value Value to be deserialized
|
172
|
+
# @return [Object] Deserialized data
|
173
|
+
def _deserialize(type, value)
|
174
|
+
case type.to_sym
|
175
|
+
when :DateTime
|
176
|
+
DateTime.parse(value)
|
177
|
+
when :Date
|
178
|
+
Date.parse(value)
|
179
|
+
when :String
|
180
|
+
value.to_s
|
181
|
+
when :Integer
|
182
|
+
value.to_i
|
183
|
+
when :Float
|
184
|
+
value.to_f
|
185
|
+
when :BOOLEAN
|
186
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
187
|
+
true
|
188
|
+
else
|
189
|
+
false
|
190
|
+
end
|
191
|
+
when :Object
|
192
|
+
# generic object (usually a Hash), return directly
|
193
|
+
value
|
194
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
195
|
+
inner_type = Regexp.last_match[:inner_type]
|
196
|
+
value.map { |v| _deserialize(inner_type, v) }
|
197
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
198
|
+
k_type = Regexp.last_match[:k_type]
|
199
|
+
v_type = Regexp.last_match[:v_type]
|
200
|
+
{}.tap do |hash|
|
201
|
+
value.each do |k, v|
|
202
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
else # model
|
206
|
+
temp_model = BudgeaClient.const_get(type).new
|
207
|
+
temp_model.build_from_hash(value)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# Returns the string representation of the object
|
212
|
+
# @return [String] String presentation of the object
|
213
|
+
def to_s
|
214
|
+
to_hash.to_s
|
215
|
+
end
|
216
|
+
|
217
|
+
# to_body is an alias to to_hash (backward compatibility)
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_body
|
220
|
+
to_hash
|
221
|
+
end
|
222
|
+
|
223
|
+
# Returns the object in the form of hash
|
224
|
+
# @return [Hash] Returns the object in the form of hash
|
225
|
+
def to_hash
|
226
|
+
hash = {}
|
227
|
+
self.class.attribute_map.each_pair do |attr, param|
|
228
|
+
value = self.send(attr)
|
229
|
+
next if value.nil?
|
230
|
+
hash[param] = _to_hash(value)
|
231
|
+
end
|
232
|
+
hash
|
233
|
+
end
|
234
|
+
|
235
|
+
# Outputs non-array value in the form of hash
|
236
|
+
# For object, use to_hash. Otherwise, just return the value
|
237
|
+
# @param [Object] value Any valid value
|
238
|
+
# @return [Hash] Returns the value in the form of hash
|
239
|
+
def _to_hash(value)
|
240
|
+
if value.is_a?(Array)
|
241
|
+
value.compact.map { |v| _to_hash(v) }
|
242
|
+
elsif value.is_a?(Hash)
|
243
|
+
{}.tap do |hash|
|
244
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
245
|
+
end
|
246
|
+
elsif value.respond_to? :to_hash
|
247
|
+
value.to_hash
|
248
|
+
else
|
249
|
+
value
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
254
|
+
end
|