cybersource_rest_client 0.0.73 → 0.0.75
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 +4 -4
- data/lib/AuthenticationSDK/core/MerchantConfig.rb +2 -1
- data/lib/cybersource_rest_client/api/batches_api.rb +9 -9
- data/lib/cybersource_rest_client/api/bin_lookup_api.rb +5 -5
- data/lib/cybersource_rest_client/api/create_new_webhooks_api.rb +6 -6
- data/lib/cybersource_rest_client/api/decision_manager_api.rb +3 -3
- data/lib/cybersource_rest_client/api/device_de_association_api.rb +168 -0
- data/lib/cybersource_rest_client/api/device_search_api.rb +78 -5
- data/lib/cybersource_rest_client/api/manage_webhooks_api.rb +9 -9
- data/lib/cybersource_rest_client/api/merchant_boarding_api.rb +3 -3
- data/lib/cybersource_rest_client/api/payment_tokens_api.rb +96 -0
- data/lib/cybersource_rest_client/api/subscriptions_api.rb +5 -2
- data/lib/cybersource_rest_client/models/create_order_request.rb +269 -229
- data/lib/cybersource_rest_client/models/de_association_request_body.rb +190 -0
- data/lib/cybersource_rest_client/models/generate_capture_context_request.rb +1 -1
- data/lib/cybersource_rest_client/models/generate_unified_checkout_capture_context_request.rb +2 -2
- data/lib/cybersource_rest_client/models/get_subscription_response.rb +15 -5
- data/lib/cybersource_rest_client/models/get_subscription_response_reactivation_information.rb +213 -0
- data/lib/cybersource_rest_client/models/inline_response_200_10.rb +292 -0
- data/lib/cybersource_rest_client/models/{inline_response_200_9_records.rb → inline_response_200_10_records.rb} +3 -3
- data/lib/cybersource_rest_client/models/{inline_response_200_9_response_record.rb → inline_response_200_10_response_record.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_9_response_record_additional_updates.rb → inline_response_200_10_response_record_additional_updates.rb} +1 -1
- data/lib/cybersource_rest_client/models/{inline_response_200_9_source_record.rb → inline_response_200_10_source_record.rb} +1 -1
- data/lib/cybersource_rest_client/models/inline_response_200_2.rb +253 -253
- data/lib/cybersource_rest_client/models/inline_response_200_5.rb +55 -10
- data/lib/cybersource_rest_client/models/inline_response_200_5_devices.rb +357 -0
- data/lib/cybersource_rest_client/models/inline_response_200_6.rb +10 -55
- data/lib/cybersource_rest_client/models/inline_response_200_7.rb +33 -37
- data/lib/cybersource_rest_client/models/{inline_response_200_6_devices.rb → inline_response_200_7_devices.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_6_payment_processor_to_terminal_map.rb → inline_response_200_7_payment_processor_to_terminal_map.rb} +1 -1
- data/lib/cybersource_rest_client/models/inline_response_200_8.rb +47 -86
- data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded.rb → inline_response_200_8__embedded.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded__links.rb → inline_response_200_8__embedded__links.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded__links_reports.rb → inline_response_200_8__embedded__links_reports.rb} +1 -1
- data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded_batches.rb → inline_response_200_8__embedded_batches.rb} +3 -3
- data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded_totals.rb → inline_response_200_8__embedded_totals.rb} +1 -1
- data/lib/cybersource_rest_client/models/inline_response_200_8__links.rb +16 -17
- data/lib/cybersource_rest_client/models/inline_response_200_9.rb +47 -49
- data/lib/cybersource_rest_client/models/inline_response_200_9__links.rb +201 -0
- data/lib/cybersource_rest_client/models/{inline_response_200_8__links_report.rb → inline_response_200_9__links_report.rb} +1 -1
- data/lib/cybersource_rest_client/models/{inline_response_200_8_billing.rb → inline_response_200_9_billing.rb} +1 -1
- data/lib/cybersource_rest_client/models/inline_response_201.rb +227 -218
- data/lib/cybersource_rest_client/models/inline_response_201_1.rb +218 -248
- data/lib/cybersource_rest_client/models/inline_response_201_2.rb +248 -281
- data/lib/cybersource_rest_client/models/{inline_response_201_1_payout_information.rb → inline_response_201_2_payout_information.rb} +216 -216
- data/lib/cybersource_rest_client/models/{inline_response_201_1_payout_information_pull_funds.rb → inline_response_201_2_payout_information_pull_funds.rb} +213 -213
- data/lib/cybersource_rest_client/models/{inline_response_201_1_payout_information_push_funds.rb → inline_response_201_2_payout_information_push_funds.rb} +417 -417
- data/lib/cybersource_rest_client/models/inline_response_201_3.rb +281 -222
- data/lib/cybersource_rest_client/models/{inline_response_201_2_integration_information.rb → inline_response_201_3_integration_information.rb} +192 -192
- data/lib/cybersource_rest_client/models/{inline_response_201_2_integration_information_tenant_configurations.rb → inline_response_201_3_integration_information_tenant_configurations.rb} +253 -253
- data/lib/cybersource_rest_client/models/{inline_response_201_2_organization_information.rb → inline_response_201_3_organization_information.rb} +217 -217
- data/lib/cybersource_rest_client/models/{inline_response_201_2_product_information_setups.rb → inline_response_201_3_product_information_setups.rb} +214 -214
- data/lib/cybersource_rest_client/models/{inline_response_201_2_registration_information.rb → inline_response_201_3_registration_information.rb} +222 -222
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups.rb → inline_response_201_3_setups.rb} +219 -219
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_commerce_solutions.rb → inline_response_201_3_setups_commerce_solutions.rb} +209 -209
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_payments.rb → inline_response_201_3_setups_payments.rb} +369 -369
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_payments_alternative_payment_methods.rb → inline_response_201_3_setups_payments_alternative_payment_methods.rb} +221 -221
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_payments_alternative_payment_methods_configuration_status.rb → inline_response_201_3_setups_payments_alternative_payment_methods_configuration_status.rb} +200 -200
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_payments_card_processing.rb → inline_response_201_3_setups_payments_card_processing.rb} +199 -199
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_payments_card_processing_configuration_status.rb → inline_response_201_3_setups_payments_card_processing_configuration_status.rb} +255 -255
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_payments_card_processing_subscription_status.rb → inline_response_201_3_setups_payments_card_processing_subscription_status.rb} +234 -234
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_payments_digital_payments.rb → inline_response_201_3_setups_payments_digital_payments.rb} +189 -189
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_risk.rb → inline_response_201_3_setups_risk.rb} +199 -199
- data/lib/cybersource_rest_client/models/{inline_response_201_2_setups_value_added_services.rb → inline_response_201_3_setups_value_added_services.rb} +209 -209
- data/lib/cybersource_rest_client/models/inline_response_201_4.rb +222 -312
- data/lib/cybersource_rest_client/models/{inline_response_201_3_key_information.rb → inline_response_201_4_key_information.rb} +300 -300
- data/lib/cybersource_rest_client/models/{inline_response_201_3_key_information_error_information.rb → inline_response_201_4_key_information_error_information.rb} +202 -202
- data/lib/cybersource_rest_client/models/{inline_response_201_3_key_information_error_information_details.rb → inline_response_201_4_key_information_error_information_details.rb} +201 -201
- data/lib/cybersource_rest_client/models/inline_response_201_5.rb +312 -277
- data/lib/cybersource_rest_client/models/inline_response_201_6.rb +277 -202
- data/lib/cybersource_rest_client/models/{inline_response_201_5_payloads.rb → inline_response_201_6_payloads.rb} +189 -189
- data/lib/cybersource_rest_client/models/{inline_response_201_5_payloads_test_payload.rb → inline_response_201_6_payloads_test_payload.rb} +190 -190
- data/lib/cybersource_rest_client/models/inline_response_201_7.rb +202 -0
- data/lib/cybersource_rest_client/models/inline_response_201_order_information.rb +189 -0
- data/lib/cybersource_rest_client/models/inline_response_201_order_information_ship_to.rb +315 -0
- data/lib/cybersource_rest_client/models/inline_response_201_payment_information.rb +199 -0
- data/lib/cybersource_rest_client/models/inline_response_201_payment_information_e_wallet.rb +196 -0
- data/lib/cybersource_rest_client/models/inline_response_201_payment_information_tokenized_payment_method.rb +213 -0
- data/lib/cybersource_rest_client/models/payments_products.rb +1 -1
- data/lib/cybersource_rest_client/models/payments_products_unified_checkout.rb +199 -0
- data/lib/cybersource_rest_client/models/payments_products_unified_checkout_configuration_information.rb +189 -0
- data/lib/cybersource_rest_client/models/payments_products_unified_checkout_configuration_information_configurations.rb +189 -0
- data/lib/cybersource_rest_client/models/payments_products_unified_checkout_configuration_information_configurations_features.rb +189 -0
- data/lib/cybersource_rest_client/models/payments_products_unified_checkout_configuration_information_configurations_features_paze.rb +213 -0
- data/lib/cybersource_rest_client/models/payments_products_unified_checkout_subscription_information.rb +225 -0
- data/lib/cybersource_rest_client/models/payments_products_unified_checkout_subscription_information_features.rb +189 -0
- data/lib/cybersource_rest_client/models/payments_products_unified_checkout_subscription_information_features_paze_for_unified_checkout.rb +190 -0
- data/lib/cybersource_rest_client/models/post_device_search_request.rb +223 -0
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_installment_information.rb +609 -609
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_account_information_card.rb +269 -269
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information.rb +364 -354
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_tokenized_card.rb +309 -309
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_tokenized_payment_method.rb +213 -0
- data/lib/cybersource_rest_client/models/pts_v2_retrieve_payment_token_get400_response.rb +252 -0
- data/lib/cybersource_rest_client/models/pts_v2_retrieve_payment_token_get502_response.rb +240 -0
- data/lib/cybersource_rest_client/models/ptsv2billingagreements_payment_information_card.rb +258 -258
- data/lib/cybersource_rest_client/models/ptsv2billingagreements_payment_information_tokenized_card.rb +275 -275
- data/lib/cybersource_rest_client/models/ptsv2intents_event_information.rb +212 -0
- data/lib/cybersource_rest_client/models/ptsv2intents_order_information_ship_to.rb +354 -332
- data/lib/cybersource_rest_client/models/ptsv2intents_payment_information.rb +220 -189
- data/lib/cybersource_rest_client/models/ptsv2intents_payment_information_e_wallet.rb +196 -0
- data/lib/cybersource_rest_client/models/ptsv2intents_payment_information_tokenized_payment_method.rb +241 -0
- data/lib/cybersource_rest_client/models/ptsv2intents_processing_information.rb +351 -219
- data/lib/cybersource_rest_client/models/ptsv2intents_recipient_information.rb +245 -0
- data/lib/cybersource_rest_client/models/ptsv2intents_sender_information.rb +277 -0
- data/lib/cybersource_rest_client/models/ptsv2intents_sender_information_account.rb +190 -0
- data/lib/cybersource_rest_client/models/ptsv2intents_travel_information.rb +211 -0
- data/lib/cybersource_rest_client/models/ptsv2intents_travel_information_agency.rb +245 -0
- data/lib/cybersource_rest_client/models/{inline_response_200_7__links.rb → ptsv2intentsid_payment_information.rb} +189 -200
- data/lib/cybersource_rest_client/models/ptsv2paymentreferences_order_information_amount_details.rb +417 -400
- data/lib/cybersource_rest_client/models/ptsv2paymentreferences_payment_information_card.rb +275 -275
- data/lib/cybersource_rest_client/models/ptsv2payments_installment_information.rb +433 -416
- data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +668 -651
- data/lib/cybersource_rest_client/models/ptsv2payments_order_information_line_items.rb +716 -699
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information.rb +356 -346
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_card.rb +445 -445
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_tokenized_card.rb +377 -377
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_tokenized_payment_method.rb +196 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_installment_information.rb +604 -604
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information_card.rb +377 -377
- data/lib/cybersource_rest_client/models/ptsv2paymenttokens_payment_information.rb +199 -0
- data/lib/cybersource_rest_client/models/ptsv2paymenttokens_processing_information.rb +192 -0
- data/lib/cybersource_rest_client/models/ptsv2payouts_payment_information_card.rb +258 -258
- data/lib/cybersource_rest_client/models/request.rb +199 -0
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_card.rb +241 -241
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_tokenized_card.rb +258 -258
- data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_tokenized_card.rb +351 -351
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_card.rb +268 -268
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_tokenized_card.rb +299 -299
- data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_card.rb +259 -259
- data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_tokenized_card.rb +259 -259
- data/lib/cybersource_rest_client/models/riskv1decisions_travel_information_legs.rb +16 -5
- data/lib/cybersource_rest_client/models/riskv1liststypeentries_payment_information_card.rb +224 -224
- data/lib/cybersource_rest_client/models/tms_bin_lookup_issuer_information.rb +264 -264
- data/lib/cybersource_rest_client/models/tms_bin_lookup_payment_account_information_card.rb +277 -277
- data/lib/cybersource_rest_client/models/tms_bin_lookup_payment_account_information_card_brands.rb +213 -213
- data/lib/cybersource_rest_client/models/tms_bin_lookup_payment_account_information_features.rb +430 -430
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_brands.rb +201 -201
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_card.rb +365 -365
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information.rb +12 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_card.rb +218 -218
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processor_information.rb +245 -234
- data/lib/cybersource_rest_client/models/update_order_request.rb +229 -229
- data/lib/cybersource_rest_client/models/upv1capturecontexts_capture_mandate.rb +12 -1
- data/lib/cybersource_rest_client/models/upv1capturecontexts_complete_mandate.rb +18 -7
- data/lib/cybersource_rest_client.rb +75 -39
- metadata +77 -41
- data/lib/cybersource_rest_client/api/device_de_association_v3_api.rb +0 -96
@@ -0,0 +1,199 @@
|
|
1
|
+
=begin
|
2
|
+
#CyberSource Merged Spec
|
3
|
+
|
4
|
+
#All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.0.1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.38
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module CyberSource
|
15
|
+
class Request
|
16
|
+
attr_accessor :processing_information
|
17
|
+
|
18
|
+
attr_accessor :payment_information
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'processing_information' => :'processingInformation',
|
24
|
+
:'payment_information' => :'paymentInformation'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute mapping from JSON key to ruby-style variable name.
|
29
|
+
def self.json_map
|
30
|
+
{
|
31
|
+
:'processing_information' => :'processing_information',
|
32
|
+
:'payment_information' => :'payment_information'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.swagger_types
|
38
|
+
{
|
39
|
+
:'processing_information' => :'Ptsv2paymenttokensProcessingInformation',
|
40
|
+
:'payment_information' => :'Ptsv2paymenttokensPaymentInformation'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Initializes the object
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
46
|
+
def initialize(attributes = {})
|
47
|
+
return unless attributes.is_a?(Hash)
|
48
|
+
|
49
|
+
# convert string to symbol for hash key
|
50
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
51
|
+
|
52
|
+
if attributes.has_key?(:'processingInformation')
|
53
|
+
self.processing_information = attributes[:'processingInformation']
|
54
|
+
end
|
55
|
+
|
56
|
+
if attributes.has_key?(:'paymentInformation')
|
57
|
+
self.payment_information = attributes[:'paymentInformation']
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
invalid_properties
|
66
|
+
end
|
67
|
+
|
68
|
+
# Check to see if the all the properties in the model are valid
|
69
|
+
# @return true if the model is valid
|
70
|
+
def valid?
|
71
|
+
true
|
72
|
+
end
|
73
|
+
|
74
|
+
# Checks equality by comparing each attribute.
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def ==(o)
|
77
|
+
return true if self.equal?(o)
|
78
|
+
self.class == o.class &&
|
79
|
+
processing_information == o.processing_information &&
|
80
|
+
payment_information == o.payment_information
|
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 [Fixnum] Hash code
|
91
|
+
def hash
|
92
|
+
[processing_information, payment_information].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 build_from_hash(attributes)
|
99
|
+
return nil unless attributes.is_a?(Hash)
|
100
|
+
self.class.swagger_types.each_pair do |key, type|
|
101
|
+
if type =~ /\AArray<(.*)>/i
|
102
|
+
# check to ensure the input is an array given that the the attribute
|
103
|
+
# is documented as an array but the input is not
|
104
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
105
|
+
self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
106
|
+
end
|
107
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
108
|
+
self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
109
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
110
|
+
end
|
111
|
+
|
112
|
+
self
|
113
|
+
end
|
114
|
+
|
115
|
+
# Deserializes the data based on type
|
116
|
+
# @param string type Data type
|
117
|
+
# @param string value Value to be deserialized
|
118
|
+
# @return [Object] Deserialized data
|
119
|
+
def _deserialize(type, value)
|
120
|
+
case type.to_sym
|
121
|
+
when :DateTime
|
122
|
+
DateTime.parse(value)
|
123
|
+
when :Date
|
124
|
+
Date.parse(value)
|
125
|
+
when :String
|
126
|
+
value.to_s
|
127
|
+
when :Integer
|
128
|
+
value.to_i
|
129
|
+
when :Float
|
130
|
+
value.to_f
|
131
|
+
when :BOOLEAN
|
132
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
133
|
+
true
|
134
|
+
else
|
135
|
+
false
|
136
|
+
end
|
137
|
+
when :Object
|
138
|
+
# generic object (usually a Hash), return directly
|
139
|
+
value
|
140
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
141
|
+
inner_type = Regexp.last_match[:inner_type]
|
142
|
+
value.map { |v| _deserialize(inner_type, v) }
|
143
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
144
|
+
k_type = Regexp.last_match[:k_type]
|
145
|
+
v_type = Regexp.last_match[:v_type]
|
146
|
+
{}.tap do |hash|
|
147
|
+
value.each do |k, v|
|
148
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
else # model
|
152
|
+
temp_model = CyberSource.const_get(type).new
|
153
|
+
temp_model.build_from_hash(value)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns the string representation of the object
|
158
|
+
# @return [String] String presentation of the object
|
159
|
+
def to_s
|
160
|
+
to_hash.to_s
|
161
|
+
end
|
162
|
+
|
163
|
+
# to_body is an alias to to_hash (backward compatibility)
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
165
|
+
def to_body
|
166
|
+
to_hash
|
167
|
+
end
|
168
|
+
|
169
|
+
# Returns the object in the form of hash
|
170
|
+
# @return [Hash] Returns the object in the form of hash
|
171
|
+
def to_hash
|
172
|
+
hash = {}
|
173
|
+
self.class.attribute_map.each_pair do |attr, param|
|
174
|
+
value = self.send(attr)
|
175
|
+
next if value.nil?
|
176
|
+
hash[param] = _to_hash(value)
|
177
|
+
end
|
178
|
+
hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Outputs non-array value in the form of hash
|
182
|
+
# For object, use to_hash. Otherwise, just return the value
|
183
|
+
# @param [Object] value Any valid value
|
184
|
+
# @return [Hash] Returns the value in the form of hash
|
185
|
+
def _to_hash(value)
|
186
|
+
if value.is_a?(Array)
|
187
|
+
value.compact.map { |v| _to_hash(v) }
|
188
|
+
elsif value.is_a?(Hash)
|
189
|
+
{}.tap do |hash|
|
190
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
191
|
+
end
|
192
|
+
elsif value.respond_to? :to_hash
|
193
|
+
value.to_hash
|
194
|
+
else
|
195
|
+
value
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|