bb_payments 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +82 -0
- data/README.md +391 -0
- data/Rakefile +8 -0
- data/bb_payments.gemspec +30 -0
- data/docs/BankSlipsApi.md +178 -0
- data/docs/BarcodeCollectionFormsIDResponseObject.md +6 -0
- data/docs/BarcodeCollectionFormsIDResponseObjectListaGuiaCodigoBarra.md +10 -0
- data/docs/BarcodeCollectionFormsIDResponseObjectListaOcorrencia.md +9 -0
- data/docs/BarcodeCollectionFormsRequestObject.md +12 -0
- data/docs/BarcodecollectionformsCollectionFormDetailsList.md +12 -0
- data/docs/BatchtransfersPaymentsList.md +22 -0
- data/docs/BatchtransferscancelPaymentIds.md +7 -0
- data/docs/Body.md +13 -0
- data/docs/CancelApi.md +63 -0
- data/docs/CollectionFormsApi.md +184 -0
- data/docs/Error.md +7 -0
- data/docs/ErrorErrors.md +8 -0
- data/docs/ErrorOAuthUnauthorized.md +10 -0
- data/docs/ErrorOAuthUnauthorizedAttributes.md +7 -0
- data/docs/InlineResponse200.md +13 -0
- data/docs/InlineResponse2001.md +29 -0
- data/docs/InlineResponse2001OcurrencesList.md +9 -0
- data/docs/InlineResponse2002.md +12 -0
- data/docs/InlineResponse2002PaymentsList.md +26 -0
- data/docs/InlineResponse2003.md +26 -0
- data/docs/InlineResponse2003ListaBoleto.md +24 -0
- data/docs/InlineResponse2003ListaDevolucao.md +9 -0
- data/docs/InlineResponse200PaymentsList.md +15 -0
- data/docs/InlineResponse201.md +13 -0
- data/docs/InlineResponse2011.md +13 -0
- data/docs/InlineResponse2011PaymentsList.md +16 -0
- data/docs/InlineResponse201PaymentsList.md +26 -0
- data/docs/InlineResponse400.md +7 -0
- data/docs/InlineResponse401.md +10 -0
- data/docs/ReturnedsApi.md +78 -0
- data/docs/RootTypeForBankSlipList.md +29 -0
- data/docs/RootTypeForBankSlipsBatchPayment.md +12 -0
- data/docs/RootTypeForBankSlipsBatchPaymentResponseObject.md +12 -0
- data/docs/RootTypeForBatchTransferGETResponseObject.md +9 -0
- data/docs/RootTypeForBatchTransferPaymentsListGET.md +21 -0
- data/docs/RootTypeForBatchTransfersCancelPaymentsListObject.md +10 -0
- data/docs/RootTypeForBatchTransfersCancelRequestObject.md +12 -0
- data/docs/RootTypeForBatchTransfersCancelResponseObject.md +7 -0
- data/docs/RootTypeForReturnedPaymentsDetails.md +33 -0
- data/docs/RootTypeForReturnedPaymentsResponseObject.md +10 -0
- data/docs/RootTypeForSlipsDetailsObject.md +23 -0
- data/docs/TransfersApi.md +309 -0
- data/lib/bb_payments/api/base.rb +10 -0
- data/lib/bb_payments/api/base_api.rb +63 -0
- data/lib/bb_payments/api/batch_payments_api.rb +50 -0
- data/lib/bb_payments/api/payments.rb +114 -0
- data/lib/bb_payments/api/transfers.rb +33 -0
- data/lib/bb_payments/api/transfers_pix.rb +52 -0
- data/lib/bb_payments/api_client.rb +414 -0
- data/lib/bb_payments/api_error.rb +57 -0
- data/lib/bb_payments/configuration.rb +246 -0
- data/lib/bb_payments/models/base_model.rb +177 -0
- data/lib/bb_payments/models/batch_pix_body.rb +30 -0
- data/lib/bb_payments/models/batch_pix_response.rb +69 -0
- data/lib/bb_payments/models/batch_transfers_body.rb +30 -0
- data/lib/bb_payments/models/batch_transfers_response.rb +64 -0
- data/lib/bb_payments/models/batchtransfers_payments_list.rb +362 -0
- data/lib/bb_payments/models/batchtransferscancel_payment_ids.rb +212 -0
- data/lib/bb_payments/models/body.rb +274 -0
- data/lib/bb_payments/models/error.rb +210 -0
- data/lib/bb_payments/models/error_errors.rb +227 -0
- data/lib/bb_payments/models/error_o_auth_unauthorized.rb +257 -0
- data/lib/bb_payments/models/error_o_auth_unauthorized_attributes.rb +213 -0
- data/lib/bb_payments/models/find_batch_payment.rb +93 -0
- data/lib/bb_payments/models/find_batch_response.rb +71 -0
- data/lib/bb_payments/models/inline_response_200.rb +270 -0
- data/lib/bb_payments/models/inline_response_200_1.rb +430 -0
- data/lib/bb_payments/models/inline_response_200_1_ocurrences_list.rb +227 -0
- data/lib/bb_payments/models/inline_response_200_2.rb +260 -0
- data/lib/bb_payments/models/inline_response_200_2_payments_list.rb +399 -0
- data/lib/bb_payments/models/inline_response_200_3.rb +487 -0
- data/lib/bb_payments/models/inline_response_200_3_lista_boleto.rb +377 -0
- data/lib/bb_payments/models/inline_response_200_3_lista_devolucao.rb +227 -0
- data/lib/bb_payments/models/inline_response_200_payments_list.rb +289 -0
- data/lib/bb_payments/models/inline_response_201.rb +270 -0
- data/lib/bb_payments/models/inline_response_201_1.rb +270 -0
- data/lib/bb_payments/models/inline_response_201_1_payments_list.rb +299 -0
- data/lib/bb_payments/models/inline_response_201_payments_list.rb +399 -0
- data/lib/bb_payments/models/inline_response_400.rb +210 -0
- data/lib/bb_payments/models/inline_response_401.rb +257 -0
- data/lib/bb_payments/models/root_type_for_bank_slip_list.rb +430 -0
- data/lib/bb_payments/models/root_type_for_bank_slips_batch_payment.rb +270 -0
- data/lib/bb_payments/models/root_type_for_bank_slips_batch_payment_response_object.rb +260 -0
- data/lib/bb_payments/models/root_type_for_batch_transfer_get_response_object.rb +230 -0
- data/lib/bb_payments/models/root_type_for_batch_transfer_payments_list_get.rb +348 -0
- data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_payments_list_object.rb +238 -0
- data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_request_object.rb +275 -0
- data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_response_object.rb +210 -0
- data/lib/bb_payments/models/root_type_for_returned_payments_details.rb +468 -0
- data/lib/bb_payments/models/root_type_for_returned_payments_response_object.rb +240 -0
- data/lib/bb_payments/models/root_type_for_slips_details_object.rb +408 -0
- data/lib/bb_payments/models/transfer_base.rb +128 -0
- data/lib/bb_payments/models/transfer_pix.rb +34 -0
- data/lib/bb_payments/models/transfer_pix_base.rb +146 -0
- data/lib/bb_payments/version.rb +3 -0
- data/lib/bb_payments.rb +85 -0
- data/spec/api/batch_payments_api_spec.rb +113 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/base_object_spec.rb +109 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/body_spec.rb +76 -0
- data/spec/models/error_errors_spec.rb +46 -0
- data/spec/models/error_o_auth_unauthorized_attributes_spec.rb +40 -0
- data/spec/models/error_o_auth_unauthorized_spec.rb +58 -0
- data/spec/models/error_spec.rb +40 -0
- data/spec/models/inline_response_200_1_ocurrences_list_spec.rb +52 -0
- data/spec/models/inline_response_200_1_spec.rb +172 -0
- data/spec/models/inline_response_200_2_payments_list_spec.rb +154 -0
- data/spec/models/inline_response_200_2_spec.rb +70 -0
- data/spec/models/inline_response_200_3_lista_boleto_spec.rb +142 -0
- data/spec/models/inline_response_200_3_lista_devolucao_spec.rb +52 -0
- data/spec/models/inline_response_200_3_spec.rb +154 -0
- data/spec/models/inline_response_200_payments_list_spec.rb +88 -0
- data/spec/models/inline_response_200_spec.rb +76 -0
- data/spec/models/inline_response_201_1_payments_list_spec.rb +94 -0
- data/spec/models/inline_response_201_1_spec.rb +76 -0
- data/spec/models/inline_response_201_payments_list_spec.rb +154 -0
- data/spec/models/inline_response_201_spec.rb +76 -0
- data/spec/models/inline_response_400_spec.rb +40 -0
- data/spec/models/inline_response_401_spec.rb +58 -0
- data/spec/models/root_type_for_bank_slip_list_spec.rb +172 -0
- data/spec/models/root_type_for_bank_slips_batch_payment_response_object_spec.rb +70 -0
- data/spec/models/root_type_for_bank_slips_batch_payment_spec.rb +70 -0
- data/spec/models/root_type_for_batch_transfer_get_response_object_spec.rb +52 -0
- data/spec/models/root_type_for_batch_transfer_payments_list_get_spec.rb +124 -0
- data/spec/models/root_type_for_batch_transfers_cancel_payments_list_object_spec.rb +58 -0
- data/spec/models/root_type_for_batch_transfers_cancel_request_object_spec.rb +70 -0
- data/spec/models/root_type_for_batch_transfers_cancel_response_object_spec.rb +40 -0
- data/spec/models/root_type_for_returned_payments_details_spec.rb +196 -0
- data/spec/models/root_type_for_returned_payments_response_object_spec.rb +58 -0
- data/spec/models/root_type_for_slips_details_object_spec.rb +136 -0
- data/spec/spec_helper.rb +110 -0
- metadata +292 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Payments-VPN
|
|
3
|
+
|
|
4
|
+
#Esta API fornece os serviços de pagamento do Banco do Brasil.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 3.5
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 3.0.24
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
module BancoBrasilPayments
|
|
15
|
+
# Objeto de Resposta do recurso Batch Transfers Cancel
|
|
16
|
+
class RootTypeForBatchTransfersCancelResponseObject
|
|
17
|
+
# Lista de cancelamentos a serem processados em lote
|
|
18
|
+
attr_accessor :payments_list
|
|
19
|
+
|
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
|
+
def self.attribute_map
|
|
22
|
+
{
|
|
23
|
+
:'payments_list' => :'paymentsList'
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Attribute type mapping.
|
|
28
|
+
def self.openapi_types
|
|
29
|
+
{
|
|
30
|
+
:'payments_list' => :'Object'
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# List of attributes with nullable: true
|
|
35
|
+
def self.openapi_nullable
|
|
36
|
+
Set.new([
|
|
37
|
+
])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Initializes the object
|
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
42
|
+
def initialize(attributes = {})
|
|
43
|
+
if (!attributes.is_a?(Hash))
|
|
44
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BancoBrasilPayments::RootTypeForBatchTransfersCancelResponseObject` initialize method"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
48
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
49
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
50
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BancoBrasilPayments::RootTypeForBatchTransfersCancelResponseObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
51
|
+
end
|
|
52
|
+
h[k.to_sym] = v
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if attributes.key?(:'payments_list')
|
|
56
|
+
if (value = attributes[:'payments_list']).is_a?(Array)
|
|
57
|
+
self.payments_list = value
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
63
|
+
# @return Array for valid properties with the reasons
|
|
64
|
+
def list_invalid_properties
|
|
65
|
+
invalid_properties = Array.new
|
|
66
|
+
invalid_properties
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Check to see if the all the properties in the model are valid
|
|
70
|
+
# @return true if the model is valid
|
|
71
|
+
def valid?
|
|
72
|
+
true
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Checks equality by comparing each attribute.
|
|
76
|
+
# @param [Object] Object to be compared
|
|
77
|
+
def ==(o)
|
|
78
|
+
return true if self.equal?(o)
|
|
79
|
+
self.class == o.class &&
|
|
80
|
+
payments_list == o.payments_list
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# @see the `==` method
|
|
84
|
+
# @param [Object] Object to be compared
|
|
85
|
+
def eql?(o)
|
|
86
|
+
self == o
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Calculates hash code according to all attributes.
|
|
90
|
+
# @return [Integer] Hash code
|
|
91
|
+
def hash
|
|
92
|
+
[payments_list].hash
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Builds the object from hash
|
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
97
|
+
# @return [Object] Returns the model itself
|
|
98
|
+
def self.build_from_hash(attributes)
|
|
99
|
+
new.build_from_hash(attributes)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Builds the object from hash
|
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
104
|
+
# @return [Object] Returns the model itself
|
|
105
|
+
def build_from_hash(attributes)
|
|
106
|
+
return nil unless attributes.is_a?(Hash)
|
|
107
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
108
|
+
if type =~ /\AArray<(.*)>/i
|
|
109
|
+
# check to ensure the input is an array given that the attribute
|
|
110
|
+
# is documented as an array but the input is not
|
|
111
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
112
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
113
|
+
end
|
|
114
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
115
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
116
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
117
|
+
self.send("#{key}=", nil)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
self
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Deserializes the data based on type
|
|
125
|
+
# @param string type Data type
|
|
126
|
+
# @param string value Value to be deserialized
|
|
127
|
+
# @return [Object] Deserialized data
|
|
128
|
+
def _deserialize(type, value)
|
|
129
|
+
case type.to_sym
|
|
130
|
+
when :DateTime
|
|
131
|
+
DateTime.parse(value)
|
|
132
|
+
when :Date
|
|
133
|
+
Date.parse(value)
|
|
134
|
+
when :String
|
|
135
|
+
value.to_s
|
|
136
|
+
when :Integer
|
|
137
|
+
value.to_i
|
|
138
|
+
when :Float
|
|
139
|
+
value.to_f
|
|
140
|
+
when :Boolean
|
|
141
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
142
|
+
true
|
|
143
|
+
else
|
|
144
|
+
false
|
|
145
|
+
end
|
|
146
|
+
when :Object
|
|
147
|
+
# generic object (usually a Hash), return directly
|
|
148
|
+
value
|
|
149
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
150
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
151
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
152
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
153
|
+
k_type = Regexp.last_match[:k_type]
|
|
154
|
+
v_type = Regexp.last_match[:v_type]
|
|
155
|
+
{}.tap do |hash|
|
|
156
|
+
value.each do |k, v|
|
|
157
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
else # model
|
|
161
|
+
BancoBrasilPayments.const_get(type).build_from_hash(value)
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Returns the string representation of the object
|
|
166
|
+
# @return [String] String presentation of the object
|
|
167
|
+
def to_s
|
|
168
|
+
to_hash.to_s
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
|
173
|
+
def to_body
|
|
174
|
+
to_hash
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Returns the object in the form of hash
|
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
|
179
|
+
def to_hash
|
|
180
|
+
hash = {}
|
|
181
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
182
|
+
value = self.send(attr)
|
|
183
|
+
if value.nil?
|
|
184
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
185
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
hash[param] = _to_hash(value)
|
|
189
|
+
end
|
|
190
|
+
hash
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Outputs non-array value in the form of hash
|
|
194
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
195
|
+
# @param [Object] value Any valid value
|
|
196
|
+
# @return [Hash] Returns the value in the form of hash
|
|
197
|
+
def _to_hash(value)
|
|
198
|
+
if value.is_a?(Array)
|
|
199
|
+
value.compact.map { |v| _to_hash(v) }
|
|
200
|
+
elsif value.is_a?(Hash)
|
|
201
|
+
{}.tap do |hash|
|
|
202
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
203
|
+
end
|
|
204
|
+
elsif value.respond_to? :to_hash
|
|
205
|
+
value.to_hash
|
|
206
|
+
else
|
|
207
|
+
value
|
|
208
|
+
end
|
|
209
|
+
end end
|
|
210
|
+
end
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Payments-VPN
|
|
3
|
+
|
|
4
|
+
#Esta API fornece os serviços de pagamento do Banco do Brasil.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 3.5
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 3.0.24
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
module BancoBrasilPayments
|
|
15
|
+
# Objeto de Detalhes dos pagamentos devolvidos
|
|
16
|
+
class RootTypeForReturnedPaymentsDetails
|
|
17
|
+
# Código identificador do pagamento.
|
|
18
|
+
attr_accessor :payment_id
|
|
19
|
+
|
|
20
|
+
# Modalidade que representa o tipo de pagamento, sendo: 126 pagamento de fornecedores; 127 pagamento de salário e 128 pagamentos diversos
|
|
21
|
+
attr_accessor :payment_type
|
|
22
|
+
|
|
23
|
+
# A modalidade que representa a maneira como o crédito foi dado, descrito a seguir: 1 significa Crédito em Conta Corrente; 3 significa DOC ou TED; 5 significa Crédito em Conta Poupança; 13 significa Liquidação de Guia com Código de Barra; 21 significa Liquidação de Guia sem Código de Barra; 30 significa Liquidação de Boleto Bancário; 31 significa Liquidação de Papéis Diversos; 71 significa Depósito Judicial.
|
|
24
|
+
attr_accessor :credit_type
|
|
25
|
+
|
|
26
|
+
# Data do pagamento (formato ddmmaaaa). Solicitações de pagamentos para dias não úteis ou após o horário limite de processamento serão pagas no próximo dia útil, com exceção de transferências entre contas do Banco do Brasil
|
|
27
|
+
attr_accessor :payment_date
|
|
28
|
+
|
|
29
|
+
# Código de identificação da instituição para crédito na câmara de compensação (no Brasil, identificado pela sigla COMPE). Por exemplo, valor 1 para o Banco do Brasil e valor 104 para a Caixa Econômica Federal. Se o valor 0 for informado, o campo ispbCode será considerado.
|
|
30
|
+
attr_accessor :clearinghouse_code
|
|
31
|
+
|
|
32
|
+
# Código identificador do Sistema de Pagamento Brasileiro (Identificado pelo acrônimo ISPB) para crédito. Por exemplo, valor 0 para o Banco do Brasil e valor 360305 para a Caixa Econômica Federal. Não considerado quando o campo clearinghouse é informado.
|
|
33
|
+
attr_accessor :ispb_code
|
|
34
|
+
|
|
35
|
+
# Código da agência para crédito.
|
|
36
|
+
attr_accessor :credit_branch_office
|
|
37
|
+
|
|
38
|
+
# Conta corrente para crédito. Não informado quando se trata de depósito judicial.
|
|
39
|
+
attr_accessor :credit_current_account
|
|
40
|
+
|
|
41
|
+
# Dígito verificador da conta corrente para crédito. Não informado quando se trata de depósito judicial.
|
|
42
|
+
attr_accessor :check_digits_credit_current_account
|
|
43
|
+
|
|
44
|
+
# Conta corrente para pagamento.
|
|
45
|
+
attr_accessor :payment_current_account
|
|
46
|
+
|
|
47
|
+
# Identifica o tipo de beneficiário, como: 1 - Pessoa física 2 - Pessoa Jurídica.
|
|
48
|
+
attr_accessor :payer_taxpayer_type
|
|
49
|
+
|
|
50
|
+
# CPF ou CNPJ do pagador.
|
|
51
|
+
attr_accessor :payer_taxpayer_registration
|
|
52
|
+
|
|
53
|
+
# Nome da pessoa ou empresa beneficiária no pagamento
|
|
54
|
+
attr_accessor :beneficiary_name
|
|
55
|
+
|
|
56
|
+
# Valor pago em reais (formato 0.00)
|
|
57
|
+
attr_accessor :paid_value
|
|
58
|
+
|
|
59
|
+
# Define o código de barras numérico do pagamento.
|
|
60
|
+
attr_accessor :numeric_bar_code
|
|
61
|
+
|
|
62
|
+
# Valor do pagamento em reais (formato 0.00)
|
|
63
|
+
attr_accessor :payment_value
|
|
64
|
+
|
|
65
|
+
# Identificação da solicitação de pagamento. É um número único, não sequencial, controlado pelo cliente, cujo valor vai de 1 a 999999.
|
|
66
|
+
attr_accessor :request_identification
|
|
67
|
+
|
|
68
|
+
# Código da agência para débito.
|
|
69
|
+
attr_accessor :debit_branch_office
|
|
70
|
+
|
|
71
|
+
# Conta corrente de débito.
|
|
72
|
+
attr_accessor :debit_current_account
|
|
73
|
+
|
|
74
|
+
# Dígito do verificador da conta corrente para débito.
|
|
75
|
+
attr_accessor :check_digits_debit_current_account
|
|
76
|
+
|
|
77
|
+
# Quatro primeiros números do cartão de crédito utilizado para pagamento (pagamento devolvido)
|
|
78
|
+
attr_accessor :credit_card_first_four_digits_start
|
|
79
|
+
|
|
80
|
+
# Quatro últimos números do cartão de crédito utilizado para pagamento (pagamento devolvido)
|
|
81
|
+
attr_accessor :credit_card_last_four_digits_end
|
|
82
|
+
|
|
83
|
+
# Documento de débito.
|
|
84
|
+
attr_accessor :debit_document
|
|
85
|
+
|
|
86
|
+
# Data da devolução do pagamento pelo Beneficiário (formato ddmmaaaa)
|
|
87
|
+
attr_accessor :returned_date
|
|
88
|
+
|
|
89
|
+
# Valor da devolução do pagamento pelo Beneficiário (formato 0.00)
|
|
90
|
+
attr_accessor :returned_value
|
|
91
|
+
|
|
92
|
+
# Código que representa o motivo da devolução do pagamento Domínios(Tipo de pagamento - Código - Mensagem): Transferência - 01 - CONTA DESTINATÁRIA DO CRÉDITO ENCERRADA; Transferência - 02 - AGÊNCIA OU CONTA DESTINATÁRIA DO CRÉDITO INVÁLIDA; Transferência - 03 - AUSÊNCIA OU DIVERGÊNCIA NA INDICAÇÃO DO CPF/CNPJ ; Transferência - 04 - MENSAGEM INVÁLIDA PARA O TIPO DE TRANSAÇÃO/FINALIDADE; Transferência - 05 - DIVERGÊNCIA NA TITULARIDADE; Transferência - 06 - TRANSFERÊNCIA INSUFICIENTE PARA A FINALIDADE INDICADA; Transferência - 57 - AG/CTA OU CPF/CNPJ DESTINATÁRIO INVÁLIDO OU TRANSF. ENTRE CONTAS CONJUNTAS; Transferência - 58 - TRANSFERÊNCIA DE UMA CONTA CORRENTE PARA UMA CONTA DE POUPANÇA; Transferência - 62 - DIVERGÊNCIA CPF/CNPJ DE UM DOS TITULARES; Transferência - 66 - TRANSFERÊNCIA DE CONTA CONJUNTA PARA CONTA INDIVIDUAL OU VICE VERSA; Transferência - 67 - SEM INDICAÇÃO DO TIPO DE CONTA; Boleto - 01 - DATA DE RECEBIMENTO NÃO NUMÉRICA; Boleto - 02 - AGÊNCIA INVÁLIDA; Boleto - 03 - VALOR RECEBIDO NÃO NUMÉRICO OU IGUAL A ZERO; Boleto - 04 - LOTE NÃO NUMÉRCIO; Boleto - 05 - BANCO INVÁLIDO; Boleto - 06 - CÓDIGO MOEDA NÃO NUMÉRICO; Boleto - 07 - DV CÓDIGO DE BARRAS NÃO NUMÉRICO; Boleto - 08 - FATOR VENCIMENTO NÃO NUMÉRICO; Boleto - 09 - VALOR TÍTULO NÃO NUMÉRICO; Boleto - 10 - CAMPO LIVRE NÃO NUMÉRICO; Boleto - 11 - DV CÓDIGO DE BARRAS NÃO CONFERE; Boleto - 12 - DATA DE RECEBIMENTO INVÁLIDA; Boleto - 13 - VALOR RECEBIMENTO ACIMA DO LIMITE;
|
|
93
|
+
attr_accessor :returned_code
|
|
94
|
+
|
|
95
|
+
# Em caso de devolução parcial dos pagamentos, este campo indicará a sequência de devolução
|
|
96
|
+
attr_accessor :returned_sequence
|
|
97
|
+
|
|
98
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
99
|
+
def self.attribute_map
|
|
100
|
+
{
|
|
101
|
+
:'payment_id' => :'paymentId',
|
|
102
|
+
:'payment_type' => :'paymentType',
|
|
103
|
+
:'credit_type' => :'creditType',
|
|
104
|
+
:'payment_date' => :'paymentDate',
|
|
105
|
+
:'clearinghouse_code' => :'clearinghouseCode',
|
|
106
|
+
:'ispb_code' => :'ispbCode',
|
|
107
|
+
:'credit_branch_office' => :'creditBranchOffice',
|
|
108
|
+
:'credit_current_account' => :'creditCurrentAccount',
|
|
109
|
+
:'check_digits_credit_current_account' => :'checkDigitsCreditCurrentAccount',
|
|
110
|
+
:'payment_current_account' => :'paymentCurrentAccount',
|
|
111
|
+
:'payer_taxpayer_type' => :'payerTaxpayerType',
|
|
112
|
+
:'payer_taxpayer_registration' => :'payerTaxpayerRegistration',
|
|
113
|
+
:'beneficiary_name' => :'beneficiaryName',
|
|
114
|
+
:'paid_value' => :'paidValue',
|
|
115
|
+
:'numeric_bar_code' => :'numericBarCode',
|
|
116
|
+
:'payment_value' => :'paymentValue',
|
|
117
|
+
:'request_identification' => :'requestIdentification',
|
|
118
|
+
:'debit_branch_office' => :'debitBranchOffice',
|
|
119
|
+
:'debit_current_account' => :'debitCurrentAccount',
|
|
120
|
+
:'check_digits_debit_current_account' => :'checkDigitsDebitCurrentAccount',
|
|
121
|
+
:'credit_card_first_four_digits_start' => :'creditCardFirstFourDigitsStart',
|
|
122
|
+
:'credit_card_last_four_digits_end' => :'creditCardLastFourDigitsEnd',
|
|
123
|
+
:'debit_document' => :'debitDocument',
|
|
124
|
+
:'returned_date' => :'returnedDate',
|
|
125
|
+
:'returned_value' => :'returnedValue',
|
|
126
|
+
:'returned_code' => :'returnedCode',
|
|
127
|
+
:'returned_sequence' => :'returnedSequence'
|
|
128
|
+
}
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Attribute type mapping.
|
|
132
|
+
def self.openapi_types
|
|
133
|
+
{
|
|
134
|
+
:'payment_id' => :'Object',
|
|
135
|
+
:'payment_type' => :'Object',
|
|
136
|
+
:'credit_type' => :'Object',
|
|
137
|
+
:'payment_date' => :'Object',
|
|
138
|
+
:'clearinghouse_code' => :'Object',
|
|
139
|
+
:'ispb_code' => :'Object',
|
|
140
|
+
:'credit_branch_office' => :'Object',
|
|
141
|
+
:'credit_current_account' => :'Object',
|
|
142
|
+
:'check_digits_credit_current_account' => :'Object',
|
|
143
|
+
:'payment_current_account' => :'Object',
|
|
144
|
+
:'payer_taxpayer_type' => :'Object',
|
|
145
|
+
:'payer_taxpayer_registration' => :'Object',
|
|
146
|
+
:'beneficiary_name' => :'Object',
|
|
147
|
+
:'paid_value' => :'Object',
|
|
148
|
+
:'numeric_bar_code' => :'Object',
|
|
149
|
+
:'payment_value' => :'Object',
|
|
150
|
+
:'request_identification' => :'Object',
|
|
151
|
+
:'debit_branch_office' => :'Object',
|
|
152
|
+
:'debit_current_account' => :'Object',
|
|
153
|
+
:'check_digits_debit_current_account' => :'Object',
|
|
154
|
+
:'credit_card_first_four_digits_start' => :'Object',
|
|
155
|
+
:'credit_card_last_four_digits_end' => :'Object',
|
|
156
|
+
:'debit_document' => :'Object',
|
|
157
|
+
:'returned_date' => :'Object',
|
|
158
|
+
:'returned_value' => :'Object',
|
|
159
|
+
:'returned_code' => :'Object',
|
|
160
|
+
:'returned_sequence' => :'Object'
|
|
161
|
+
}
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# List of attributes with nullable: true
|
|
165
|
+
def self.openapi_nullable
|
|
166
|
+
Set.new([
|
|
167
|
+
])
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Initializes the object
|
|
171
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
172
|
+
def initialize(attributes = {})
|
|
173
|
+
if (!attributes.is_a?(Hash))
|
|
174
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BancoBrasilPayments::RootTypeForReturnedPaymentsDetails` initialize method"
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
178
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
179
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
180
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BancoBrasilPayments::RootTypeForReturnedPaymentsDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
181
|
+
end
|
|
182
|
+
h[k.to_sym] = v
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if attributes.key?(:'payment_id')
|
|
186
|
+
self.payment_id = attributes[:'payment_id']
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
if attributes.key?(:'payment_type')
|
|
190
|
+
self.payment_type = attributes[:'payment_type']
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
if attributes.key?(:'credit_type')
|
|
194
|
+
self.credit_type = attributes[:'credit_type']
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if attributes.key?(:'payment_date')
|
|
198
|
+
self.payment_date = attributes[:'payment_date']
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
if attributes.key?(:'clearinghouse_code')
|
|
202
|
+
self.clearinghouse_code = attributes[:'clearinghouse_code']
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
if attributes.key?(:'ispb_code')
|
|
206
|
+
self.ispb_code = attributes[:'ispb_code']
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
if attributes.key?(:'credit_branch_office')
|
|
210
|
+
self.credit_branch_office = attributes[:'credit_branch_office']
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
if attributes.key?(:'credit_current_account')
|
|
214
|
+
self.credit_current_account = attributes[:'credit_current_account']
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
if attributes.key?(:'check_digits_credit_current_account')
|
|
218
|
+
self.check_digits_credit_current_account = attributes[:'check_digits_credit_current_account']
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
if attributes.key?(:'payment_current_account')
|
|
222
|
+
self.payment_current_account = attributes[:'payment_current_account']
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
if attributes.key?(:'payer_taxpayer_type')
|
|
226
|
+
self.payer_taxpayer_type = attributes[:'payer_taxpayer_type']
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
if attributes.key?(:'payer_taxpayer_registration')
|
|
230
|
+
self.payer_taxpayer_registration = attributes[:'payer_taxpayer_registration']
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
if attributes.key?(:'beneficiary_name')
|
|
234
|
+
self.beneficiary_name = attributes[:'beneficiary_name']
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
if attributes.key?(:'paid_value')
|
|
238
|
+
self.paid_value = attributes[:'paid_value']
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
if attributes.key?(:'numeric_bar_code')
|
|
242
|
+
self.numeric_bar_code = attributes[:'numeric_bar_code']
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
if attributes.key?(:'payment_value')
|
|
246
|
+
self.payment_value = attributes[:'payment_value']
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
if attributes.key?(:'request_identification')
|
|
250
|
+
self.request_identification = attributes[:'request_identification']
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
if attributes.key?(:'debit_branch_office')
|
|
254
|
+
self.debit_branch_office = attributes[:'debit_branch_office']
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
if attributes.key?(:'debit_current_account')
|
|
258
|
+
self.debit_current_account = attributes[:'debit_current_account']
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
if attributes.key?(:'check_digits_debit_current_account')
|
|
262
|
+
self.check_digits_debit_current_account = attributes[:'check_digits_debit_current_account']
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
if attributes.key?(:'credit_card_first_four_digits_start')
|
|
266
|
+
self.credit_card_first_four_digits_start = attributes[:'credit_card_first_four_digits_start']
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
if attributes.key?(:'credit_card_last_four_digits_end')
|
|
270
|
+
self.credit_card_last_four_digits_end = attributes[:'credit_card_last_four_digits_end']
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
if attributes.key?(:'debit_document')
|
|
274
|
+
self.debit_document = attributes[:'debit_document']
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
if attributes.key?(:'returned_date')
|
|
278
|
+
self.returned_date = attributes[:'returned_date']
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
if attributes.key?(:'returned_value')
|
|
282
|
+
self.returned_value = attributes[:'returned_value']
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
if attributes.key?(:'returned_code')
|
|
286
|
+
self.returned_code = attributes[:'returned_code']
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
if attributes.key?(:'returned_sequence')
|
|
290
|
+
self.returned_sequence = attributes[:'returned_sequence']
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
295
|
+
# @return Array for valid properties with the reasons
|
|
296
|
+
def list_invalid_properties
|
|
297
|
+
invalid_properties = Array.new
|
|
298
|
+
invalid_properties
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# Check to see if the all the properties in the model are valid
|
|
302
|
+
# @return true if the model is valid
|
|
303
|
+
def valid?
|
|
304
|
+
true
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# Checks equality by comparing each attribute.
|
|
308
|
+
# @param [Object] Object to be compared
|
|
309
|
+
def ==(o)
|
|
310
|
+
return true if self.equal?(o)
|
|
311
|
+
self.class == o.class &&
|
|
312
|
+
payment_id == o.payment_id &&
|
|
313
|
+
payment_type == o.payment_type &&
|
|
314
|
+
credit_type == o.credit_type &&
|
|
315
|
+
payment_date == o.payment_date &&
|
|
316
|
+
clearinghouse_code == o.clearinghouse_code &&
|
|
317
|
+
ispb_code == o.ispb_code &&
|
|
318
|
+
credit_branch_office == o.credit_branch_office &&
|
|
319
|
+
credit_current_account == o.credit_current_account &&
|
|
320
|
+
check_digits_credit_current_account == o.check_digits_credit_current_account &&
|
|
321
|
+
payment_current_account == o.payment_current_account &&
|
|
322
|
+
payer_taxpayer_type == o.payer_taxpayer_type &&
|
|
323
|
+
payer_taxpayer_registration == o.payer_taxpayer_registration &&
|
|
324
|
+
beneficiary_name == o.beneficiary_name &&
|
|
325
|
+
paid_value == o.paid_value &&
|
|
326
|
+
numeric_bar_code == o.numeric_bar_code &&
|
|
327
|
+
payment_value == o.payment_value &&
|
|
328
|
+
request_identification == o.request_identification &&
|
|
329
|
+
debit_branch_office == o.debit_branch_office &&
|
|
330
|
+
debit_current_account == o.debit_current_account &&
|
|
331
|
+
check_digits_debit_current_account == o.check_digits_debit_current_account &&
|
|
332
|
+
credit_card_first_four_digits_start == o.credit_card_first_four_digits_start &&
|
|
333
|
+
credit_card_last_four_digits_end == o.credit_card_last_four_digits_end &&
|
|
334
|
+
debit_document == o.debit_document &&
|
|
335
|
+
returned_date == o.returned_date &&
|
|
336
|
+
returned_value == o.returned_value &&
|
|
337
|
+
returned_code == o.returned_code &&
|
|
338
|
+
returned_sequence == o.returned_sequence
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
# @see the `==` method
|
|
342
|
+
# @param [Object] Object to be compared
|
|
343
|
+
def eql?(o)
|
|
344
|
+
self == o
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# Calculates hash code according to all attributes.
|
|
348
|
+
# @return [Integer] Hash code
|
|
349
|
+
def hash
|
|
350
|
+
[payment_id, payment_type, credit_type, payment_date, clearinghouse_code, ispb_code, credit_branch_office, credit_current_account, check_digits_credit_current_account, payment_current_account, payer_taxpayer_type, payer_taxpayer_registration, beneficiary_name, paid_value, numeric_bar_code, payment_value, request_identification, debit_branch_office, debit_current_account, check_digits_debit_current_account, credit_card_first_four_digits_start, credit_card_last_four_digits_end, debit_document, returned_date, returned_value, returned_code, returned_sequence].hash
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Builds the object from hash
|
|
354
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
355
|
+
# @return [Object] Returns the model itself
|
|
356
|
+
def self.build_from_hash(attributes)
|
|
357
|
+
new.build_from_hash(attributes)
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Builds the object from hash
|
|
361
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
362
|
+
# @return [Object] Returns the model itself
|
|
363
|
+
def build_from_hash(attributes)
|
|
364
|
+
return nil unless attributes.is_a?(Hash)
|
|
365
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
366
|
+
if type =~ /\AArray<(.*)>/i
|
|
367
|
+
# check to ensure the input is an array given that the attribute
|
|
368
|
+
# is documented as an array but the input is not
|
|
369
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
370
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
371
|
+
end
|
|
372
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
373
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
374
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
375
|
+
self.send("#{key}=", nil)
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
self
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
# Deserializes the data based on type
|
|
383
|
+
# @param string type Data type
|
|
384
|
+
# @param string value Value to be deserialized
|
|
385
|
+
# @return [Object] Deserialized data
|
|
386
|
+
def _deserialize(type, value)
|
|
387
|
+
case type.to_sym
|
|
388
|
+
when :DateTime
|
|
389
|
+
DateTime.parse(value)
|
|
390
|
+
when :Date
|
|
391
|
+
Date.parse(value)
|
|
392
|
+
when :String
|
|
393
|
+
value.to_s
|
|
394
|
+
when :Integer
|
|
395
|
+
value.to_i
|
|
396
|
+
when :Float
|
|
397
|
+
value.to_f
|
|
398
|
+
when :Boolean
|
|
399
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
400
|
+
true
|
|
401
|
+
else
|
|
402
|
+
false
|
|
403
|
+
end
|
|
404
|
+
when :Object
|
|
405
|
+
# generic object (usually a Hash), return directly
|
|
406
|
+
value
|
|
407
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
408
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
409
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
410
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
411
|
+
k_type = Regexp.last_match[:k_type]
|
|
412
|
+
v_type = Regexp.last_match[:v_type]
|
|
413
|
+
{}.tap do |hash|
|
|
414
|
+
value.each do |k, v|
|
|
415
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
else # model
|
|
419
|
+
BancoBrasilPayments.const_get(type).build_from_hash(value)
|
|
420
|
+
end
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
# Returns the string representation of the object
|
|
424
|
+
# @return [String] String presentation of the object
|
|
425
|
+
def to_s
|
|
426
|
+
to_hash.to_s
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
430
|
+
# @return [Hash] Returns the object in the form of hash
|
|
431
|
+
def to_body
|
|
432
|
+
to_hash
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
# Returns the object in the form of hash
|
|
436
|
+
# @return [Hash] Returns the object in the form of hash
|
|
437
|
+
def to_hash
|
|
438
|
+
hash = {}
|
|
439
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
440
|
+
value = self.send(attr)
|
|
441
|
+
if value.nil?
|
|
442
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
443
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
hash[param] = _to_hash(value)
|
|
447
|
+
end
|
|
448
|
+
hash
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# Outputs non-array value in the form of hash
|
|
452
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
453
|
+
# @param [Object] value Any valid value
|
|
454
|
+
# @return [Hash] Returns the value in the form of hash
|
|
455
|
+
def _to_hash(value)
|
|
456
|
+
if value.is_a?(Array)
|
|
457
|
+
value.compact.map { |v| _to_hash(v) }
|
|
458
|
+
elsif value.is_a?(Hash)
|
|
459
|
+
{}.tap do |hash|
|
|
460
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
461
|
+
end
|
|
462
|
+
elsif value.respond_to? :to_hash
|
|
463
|
+
value.to_hash
|
|
464
|
+
else
|
|
465
|
+
value
|
|
466
|
+
end
|
|
467
|
+
end end
|
|
468
|
+
end
|