ultracart_api 3.10.14 → 3.10.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -97
  3. data/docs/ChannelPartnerApi.md +51 -0
  4. data/docs/{DelayAutoOrdersResponse.md → ChannelPartnerEstimateTaxResponse.md} +2 -2
  5. data/lib/ultracart_api/api/channel_partner_api.rb +55 -0
  6. data/lib/ultracart_api/models/{stripe_connect_response.rb → channel_partner_estimate_tax_response.rb} +8 -8
  7. data/lib/ultracart_api/version.rb +1 -1
  8. data/lib/ultracart_api.rb +1 -39
  9. metadata +4 -80
  10. data/docs/ConfigurationApi.md +0 -756
  11. data/docs/PaymentsConfiguration.md +0 -24
  12. data/docs/PaymentsConfigurationAffirm.md +0 -15
  13. data/docs/PaymentsConfigurationAmazon.md +0 -15
  14. data/docs/PaymentsConfigurationCOD.md +0 -13
  15. data/docs/PaymentsConfigurationCash.md +0 -9
  16. data/docs/PaymentsConfigurationCheck.md +0 -19
  17. data/docs/PaymentsConfigurationCreditCard.md +0 -17
  18. data/docs/PaymentsConfigurationCreditCardType.md +0 -18
  19. data/docs/PaymentsConfigurationEcheck.md +0 -12
  20. data/docs/PaymentsConfigurationInsurance.md +0 -9
  21. data/docs/PaymentsConfigurationLoanHero.md +0 -12
  22. data/docs/PaymentsConfigurationMoneyOrder.md +0 -11
  23. data/docs/PaymentsConfigurationPayPal.md +0 -36
  24. data/docs/PaymentsConfigurationPurchaseOrder.md +0 -11
  25. data/docs/PaymentsConfigurationQuoteRequest.md +0 -10
  26. data/docs/PaymentsConfigurationResponse.md +0 -12
  27. data/docs/PaymentsConfigurationRestrictions.md +0 -21
  28. data/docs/PaymentsConfigurationRestrictionsTheme.md +0 -10
  29. data/docs/PaymentsConfigurationSezzle.md +0 -15
  30. data/docs/PaymentsConfigurationTestMethod.md +0 -18
  31. data/docs/PaymentsConfigurationWePay.md +0 -35
  32. data/docs/PaymentsConfigurationWireTransfer.md +0 -18
  33. data/docs/PaymentsThemeTransactionType.md +0 -10
  34. data/docs/PaymentsWepayEnroll.md +0 -22
  35. data/docs/RotatingTransactionGateway.md +0 -51
  36. data/docs/RotatingTransactionGatewayResponse.md +0 -12
  37. data/docs/RotatingTransactionGatewaysResponse.md +0 -12
  38. data/docs/RtgCurrency.md +0 -10
  39. data/docs/RtgDayOfMonthRestriction.md +0 -9
  40. data/docs/RtgDayOfWeekRestriction.md +0 -10
  41. data/docs/RtgSummaryGateway.md +0 -24
  42. data/docs/RtgSummaryResponse.md +0 -14
  43. data/docs/RtgThemeRestriction.md +0 -10
  44. data/docs/StripeConnectResponse.md +0 -12
  45. data/docs/TransactionGateway.md +0 -71
  46. data/docs/TransactionGatewaysRequest.md +0 -10
  47. data/docs/TransactionGatewaysResponse.md +0 -12
  48. data/lib/ultracart_api/api/configuration_api.rb +0 -843
  49. data/lib/ultracart_api/models/delay_auto_orders_response.rb +0 -221
  50. data/lib/ultracart_api/models/payments_configuration.rb +0 -329
  51. data/lib/ultracart_api/models/payments_configuration_affirm.rb +0 -288
  52. data/lib/ultracart_api/models/payments_configuration_amazon.rb +0 -288
  53. data/lib/ultracart_api/models/payments_configuration_cash.rb +0 -194
  54. data/lib/ultracart_api/models/payments_configuration_check.rb +0 -294
  55. data/lib/ultracart_api/models/payments_configuration_cod.rb +0 -234
  56. data/lib/ultracart_api/models/payments_configuration_credit_card.rb +0 -279
  57. data/lib/ultracart_api/models/payments_configuration_credit_card_type.rb +0 -318
  58. data/lib/ultracart_api/models/payments_configuration_echeck.rb +0 -226
  59. data/lib/ultracart_api/models/payments_configuration_insurance.rb +0 -194
  60. data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +0 -224
  61. data/lib/ultracart_api/models/payments_configuration_money_order.rb +0 -214
  62. data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +0 -534
  63. data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +0 -214
  64. data/lib/ultracart_api/models/payments_configuration_quote_request.rb +0 -204
  65. data/lib/ultracart_api/models/payments_configuration_response.rb +0 -221
  66. data/lib/ultracart_api/models/payments_configuration_restrictions.rb +0 -447
  67. data/lib/ultracart_api/models/payments_configuration_restrictions_theme.rb +0 -202
  68. data/lib/ultracart_api/models/payments_configuration_sezzle.rb +0 -288
  69. data/lib/ultracart_api/models/payments_configuration_test_method.rb +0 -319
  70. data/lib/ultracart_api/models/payments_configuration_we_pay.rb +0 -454
  71. data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +0 -284
  72. data/lib/ultracart_api/models/payments_theme_transaction_type.rb +0 -239
  73. data/lib/ultracart_api/models/payments_wepay_enroll.rb +0 -310
  74. data/lib/ultracart_api/models/rotating_transaction_gateway.rb +0 -675
  75. data/lib/ultracart_api/models/rotating_transaction_gateway_response.rb +0 -221
  76. data/lib/ultracart_api/models/rotating_transaction_gateways_response.rb +0 -223
  77. data/lib/ultracart_api/models/rtg_currency.rb +0 -205
  78. data/lib/ultracart_api/models/rtg_day_of_month_restriction.rb +0 -195
  79. data/lib/ultracart_api/models/rtg_day_of_week_restriction.rb +0 -205
  80. data/lib/ultracart_api/models/rtg_summary_gateway.rb +0 -329
  81. data/lib/ultracart_api/models/rtg_summary_response.rb +0 -240
  82. data/lib/ultracart_api/models/rtg_theme_restriction.rb +0 -239
  83. data/lib/ultracart_api/models/transaction_gateway.rb +0 -823
  84. data/lib/ultracart_api/models/transaction_gateways_request.rb +0 -242
  85. data/lib/ultracart_api/models/transaction_gateways_response.rb +0 -223
@@ -1,288 +0,0 @@
1
- =begin
2
- #UltraCart Rest API V2
3
-
4
- #UltraCart REST API Version 2
5
-
6
- OpenAPI spec version: 2.0.0
7
- Contact: support@ultracart.com
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.15-SNAPSHOT
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module UltracartClient
16
- class PaymentsConfigurationAffirm
17
- # Master flag indicating this merchant accepts Affirm payments
18
- attr_accessor :accept_affirm
19
-
20
- # Optional Quickbooks code for this payment method
21
- attr_accessor :accounting_code
22
-
23
- # Optional Quickbooks Deposit to Account value
24
- attr_accessor :deposit_to_account
25
-
26
- # Environment
27
- attr_accessor :environment
28
-
29
- # Financial product key
30
- attr_accessor :financial_product_key
31
-
32
- # Private API key
33
- attr_accessor :private_api_key
34
-
35
- # Public API key
36
- attr_accessor :public_api_key
37
-
38
- attr_accessor :restrictions
39
-
40
- class EnumAttributeValidator
41
- attr_reader :datatype
42
- attr_reader :allowable_values
43
-
44
- def initialize(datatype, allowable_values)
45
- @allowable_values = allowable_values.map do |value|
46
- case datatype.to_s
47
- when /Integer/i
48
- value.to_i
49
- when /Float/i
50
- value.to_f
51
- else
52
- value
53
- end
54
- end
55
- end
56
-
57
- def valid?(value)
58
- !value || allowable_values.include?(value)
59
- end
60
- end
61
-
62
- # Attribute mapping from ruby-style variable name to JSON key.
63
- def self.attribute_map
64
- {
65
- :'accept_affirm' => :'accept_affirm',
66
- :'accounting_code' => :'accounting_code',
67
- :'deposit_to_account' => :'deposit_to_account',
68
- :'environment' => :'environment',
69
- :'financial_product_key' => :'financial_product_key',
70
- :'private_api_key' => :'private_api_key',
71
- :'public_api_key' => :'public_api_key',
72
- :'restrictions' => :'restrictions'
73
- }
74
- end
75
-
76
- # Attribute type mapping.
77
- def self.swagger_types
78
- {
79
- :'accept_affirm' => :'BOOLEAN',
80
- :'accounting_code' => :'String',
81
- :'deposit_to_account' => :'String',
82
- :'environment' => :'String',
83
- :'financial_product_key' => :'String',
84
- :'private_api_key' => :'String',
85
- :'public_api_key' => :'String',
86
- :'restrictions' => :'PaymentsConfigurationRestrictions'
87
- }
88
- end
89
-
90
- # Initializes the object
91
- # @param [Hash] attributes Model attributes in the form of hash
92
- def initialize(attributes = {})
93
- return unless attributes.is_a?(Hash)
94
-
95
- # convert string to symbol for hash key
96
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
-
98
- if attributes.has_key?(:'accept_affirm')
99
- self.accept_affirm = attributes[:'accept_affirm']
100
- end
101
-
102
- if attributes.has_key?(:'accounting_code')
103
- self.accounting_code = attributes[:'accounting_code']
104
- end
105
-
106
- if attributes.has_key?(:'deposit_to_account')
107
- self.deposit_to_account = attributes[:'deposit_to_account']
108
- end
109
-
110
- if attributes.has_key?(:'environment')
111
- self.environment = attributes[:'environment']
112
- end
113
-
114
- if attributes.has_key?(:'financial_product_key')
115
- self.financial_product_key = attributes[:'financial_product_key']
116
- end
117
-
118
- if attributes.has_key?(:'private_api_key')
119
- self.private_api_key = attributes[:'private_api_key']
120
- end
121
-
122
- if attributes.has_key?(:'public_api_key')
123
- self.public_api_key = attributes[:'public_api_key']
124
- end
125
-
126
- if attributes.has_key?(:'restrictions')
127
- self.restrictions = attributes[:'restrictions']
128
- end
129
- end
130
-
131
- # Show invalid properties with the reasons. Usually used together with valid?
132
- # @return Array for valid properties with the reasons
133
- def list_invalid_properties
134
- invalid_properties = Array.new
135
- invalid_properties
136
- end
137
-
138
- # Check to see if the all the properties in the model are valid
139
- # @return true if the model is valid
140
- def valid?
141
- environment_validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
142
- return false unless environment_validator.valid?(@environment)
143
- true
144
- end
145
-
146
- # Custom attribute writer method checking allowed values (enum).
147
- # @param [Object] environment Object to be assigned
148
- def environment=(environment)
149
- validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
150
- unless validator.valid?(environment)
151
- fail ArgumentError, 'invalid value for "environment", must be one of #{validator.allowable_values}.'
152
- end
153
- @environment = environment
154
- end
155
-
156
- # Checks equality by comparing each attribute.
157
- # @param [Object] Object to be compared
158
- def ==(o)
159
- return true if self.equal?(o)
160
- self.class == o.class &&
161
- accept_affirm == o.accept_affirm &&
162
- accounting_code == o.accounting_code &&
163
- deposit_to_account == o.deposit_to_account &&
164
- environment == o.environment &&
165
- financial_product_key == o.financial_product_key &&
166
- private_api_key == o.private_api_key &&
167
- public_api_key == o.public_api_key &&
168
- restrictions == o.restrictions
169
- end
170
-
171
- # @see the `==` method
172
- # @param [Object] Object to be compared
173
- def eql?(o)
174
- self == o
175
- end
176
-
177
- # Calculates hash code according to all attributes.
178
- # @return [Fixnum] Hash code
179
- def hash
180
- [accept_affirm, accounting_code, deposit_to_account, environment, financial_product_key, private_api_key, public_api_key, restrictions].hash
181
- end
182
-
183
- # Builds the object from hash
184
- # @param [Hash] attributes Model attributes in the form of hash
185
- # @return [Object] Returns the model itself
186
- def build_from_hash(attributes)
187
- return nil unless attributes.is_a?(Hash)
188
- self.class.swagger_types.each_pair do |key, type|
189
- if type =~ /\AArray<(.*)>/i
190
- # check to ensure the input is an array given that the attribute
191
- # is documented as an array but the input is not
192
- if attributes[self.class.attribute_map[key]].is_a?(Array)
193
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
194
- end
195
- elsif !attributes[self.class.attribute_map[key]].nil?
196
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
197
- end # or else data not found in attributes(hash), not an issue as the data can be optional
198
- end
199
-
200
- self
201
- end
202
-
203
- # Deserializes the data based on type
204
- # @param string type Data type
205
- # @param string value Value to be deserialized
206
- # @return [Object] Deserialized data
207
- def _deserialize(type, value)
208
- case type.to_sym
209
- when :DateTime
210
- DateTime.parse(value)
211
- when :Date
212
- Date.parse(value)
213
- when :String
214
- value.to_s
215
- when :Integer
216
- value.to_i
217
- when :Float
218
- value.to_f
219
- when :BOOLEAN
220
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
221
- true
222
- else
223
- false
224
- end
225
- when :Object
226
- # generic object (usually a Hash), return directly
227
- value
228
- when /\AArray<(?<inner_type>.+)>\z/
229
- inner_type = Regexp.last_match[:inner_type]
230
- value.map { |v| _deserialize(inner_type, v) }
231
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
232
- k_type = Regexp.last_match[:k_type]
233
- v_type = Regexp.last_match[:v_type]
234
- {}.tap do |hash|
235
- value.each do |k, v|
236
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
237
- end
238
- end
239
- else # model
240
- temp_model = UltracartClient.const_get(type).new
241
- temp_model.build_from_hash(value)
242
- end
243
- end
244
-
245
- # Returns the string representation of the object
246
- # @return [String] String presentation of the object
247
- def to_s
248
- to_hash.to_s
249
- end
250
-
251
- # to_body is an alias to to_hash (backward compatibility)
252
- # @return [Hash] Returns the object in the form of hash
253
- def to_body
254
- to_hash
255
- end
256
-
257
- # Returns the object in the form of hash
258
- # @return [Hash] Returns the object in the form of hash
259
- def to_hash
260
- hash = {}
261
- self.class.attribute_map.each_pair do |attr, param|
262
- value = self.send(attr)
263
- next if value.nil?
264
- hash[param] = _to_hash(value)
265
- end
266
- hash
267
- end
268
-
269
- # Outputs non-array value in the form of hash
270
- # For object, use to_hash. Otherwise, just return the value
271
- # @param [Object] value Any valid value
272
- # @return [Hash] Returns the value in the form of hash
273
- def _to_hash(value)
274
- if value.is_a?(Array)
275
- value.compact.map { |v| _to_hash(v) }
276
- elsif value.is_a?(Hash)
277
- {}.tap do |hash|
278
- value.each { |k, v| hash[k] = _to_hash(v) }
279
- end
280
- elsif value.respond_to? :to_hash
281
- value.to_hash
282
- else
283
- value
284
- end
285
- end
286
-
287
- end
288
- end
@@ -1,288 +0,0 @@
1
- =begin
2
- #UltraCart Rest API V2
3
-
4
- #UltraCart REST API Version 2
5
-
6
- OpenAPI spec version: 2.0.0
7
- Contact: support@ultracart.com
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.15-SNAPSHOT
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module UltracartClient
16
- class PaymentsConfigurationAmazon
17
- # Master flag to determine if this merchant accepts Pay by Amazon
18
- attr_accessor :accept_amazon
19
-
20
- # Amazon access key ID
21
- attr_accessor :access_key_id
22
-
23
- # Optional accounting code for use with Quickbooks integrations
24
- attr_accessor :accounting_code
25
-
26
- # Amazon merchant ID
27
- attr_accessor :amazon_merchant_id
28
-
29
- # Optional deposit to account field for use with Quickbooks integrations
30
- attr_accessor :deposit_to_account
31
-
32
- # Environment
33
- attr_accessor :environment
34
-
35
- attr_accessor :restrictions
36
-
37
- # Amazon secret access key
38
- attr_accessor :secret_access_key
39
-
40
- class EnumAttributeValidator
41
- attr_reader :datatype
42
- attr_reader :allowable_values
43
-
44
- def initialize(datatype, allowable_values)
45
- @allowable_values = allowable_values.map do |value|
46
- case datatype.to_s
47
- when /Integer/i
48
- value.to_i
49
- when /Float/i
50
- value.to_f
51
- else
52
- value
53
- end
54
- end
55
- end
56
-
57
- def valid?(value)
58
- !value || allowable_values.include?(value)
59
- end
60
- end
61
-
62
- # Attribute mapping from ruby-style variable name to JSON key.
63
- def self.attribute_map
64
- {
65
- :'accept_amazon' => :'accept_amazon',
66
- :'access_key_id' => :'access_key_id',
67
- :'accounting_code' => :'accounting_code',
68
- :'amazon_merchant_id' => :'amazon_merchant_id',
69
- :'deposit_to_account' => :'deposit_to_account',
70
- :'environment' => :'environment',
71
- :'restrictions' => :'restrictions',
72
- :'secret_access_key' => :'secret_access_key'
73
- }
74
- end
75
-
76
- # Attribute type mapping.
77
- def self.swagger_types
78
- {
79
- :'accept_amazon' => :'BOOLEAN',
80
- :'access_key_id' => :'String',
81
- :'accounting_code' => :'String',
82
- :'amazon_merchant_id' => :'String',
83
- :'deposit_to_account' => :'String',
84
- :'environment' => :'String',
85
- :'restrictions' => :'PaymentsConfigurationRestrictions',
86
- :'secret_access_key' => :'String'
87
- }
88
- end
89
-
90
- # Initializes the object
91
- # @param [Hash] attributes Model attributes in the form of hash
92
- def initialize(attributes = {})
93
- return unless attributes.is_a?(Hash)
94
-
95
- # convert string to symbol for hash key
96
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
-
98
- if attributes.has_key?(:'accept_amazon')
99
- self.accept_amazon = attributes[:'accept_amazon']
100
- end
101
-
102
- if attributes.has_key?(:'access_key_id')
103
- self.access_key_id = attributes[:'access_key_id']
104
- end
105
-
106
- if attributes.has_key?(:'accounting_code')
107
- self.accounting_code = attributes[:'accounting_code']
108
- end
109
-
110
- if attributes.has_key?(:'amazon_merchant_id')
111
- self.amazon_merchant_id = attributes[:'amazon_merchant_id']
112
- end
113
-
114
- if attributes.has_key?(:'deposit_to_account')
115
- self.deposit_to_account = attributes[:'deposit_to_account']
116
- end
117
-
118
- if attributes.has_key?(:'environment')
119
- self.environment = attributes[:'environment']
120
- end
121
-
122
- if attributes.has_key?(:'restrictions')
123
- self.restrictions = attributes[:'restrictions']
124
- end
125
-
126
- if attributes.has_key?(:'secret_access_key')
127
- self.secret_access_key = attributes[:'secret_access_key']
128
- end
129
- end
130
-
131
- # Show invalid properties with the reasons. Usually used together with valid?
132
- # @return Array for valid properties with the reasons
133
- def list_invalid_properties
134
- invalid_properties = Array.new
135
- invalid_properties
136
- end
137
-
138
- # Check to see if the all the properties in the model are valid
139
- # @return true if the model is valid
140
- def valid?
141
- environment_validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
142
- return false unless environment_validator.valid?(@environment)
143
- true
144
- end
145
-
146
- # Custom attribute writer method checking allowed values (enum).
147
- # @param [Object] environment Object to be assigned
148
- def environment=(environment)
149
- validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
150
- unless validator.valid?(environment)
151
- fail ArgumentError, 'invalid value for "environment", must be one of #{validator.allowable_values}.'
152
- end
153
- @environment = environment
154
- end
155
-
156
- # Checks equality by comparing each attribute.
157
- # @param [Object] Object to be compared
158
- def ==(o)
159
- return true if self.equal?(o)
160
- self.class == o.class &&
161
- accept_amazon == o.accept_amazon &&
162
- access_key_id == o.access_key_id &&
163
- accounting_code == o.accounting_code &&
164
- amazon_merchant_id == o.amazon_merchant_id &&
165
- deposit_to_account == o.deposit_to_account &&
166
- environment == o.environment &&
167
- restrictions == o.restrictions &&
168
- secret_access_key == o.secret_access_key
169
- end
170
-
171
- # @see the `==` method
172
- # @param [Object] Object to be compared
173
- def eql?(o)
174
- self == o
175
- end
176
-
177
- # Calculates hash code according to all attributes.
178
- # @return [Fixnum] Hash code
179
- def hash
180
- [accept_amazon, access_key_id, accounting_code, amazon_merchant_id, deposit_to_account, environment, restrictions, secret_access_key].hash
181
- end
182
-
183
- # Builds the object from hash
184
- # @param [Hash] attributes Model attributes in the form of hash
185
- # @return [Object] Returns the model itself
186
- def build_from_hash(attributes)
187
- return nil unless attributes.is_a?(Hash)
188
- self.class.swagger_types.each_pair do |key, type|
189
- if type =~ /\AArray<(.*)>/i
190
- # check to ensure the input is an array given that the attribute
191
- # is documented as an array but the input is not
192
- if attributes[self.class.attribute_map[key]].is_a?(Array)
193
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
194
- end
195
- elsif !attributes[self.class.attribute_map[key]].nil?
196
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
197
- end # or else data not found in attributes(hash), not an issue as the data can be optional
198
- end
199
-
200
- self
201
- end
202
-
203
- # Deserializes the data based on type
204
- # @param string type Data type
205
- # @param string value Value to be deserialized
206
- # @return [Object] Deserialized data
207
- def _deserialize(type, value)
208
- case type.to_sym
209
- when :DateTime
210
- DateTime.parse(value)
211
- when :Date
212
- Date.parse(value)
213
- when :String
214
- value.to_s
215
- when :Integer
216
- value.to_i
217
- when :Float
218
- value.to_f
219
- when :BOOLEAN
220
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
221
- true
222
- else
223
- false
224
- end
225
- when :Object
226
- # generic object (usually a Hash), return directly
227
- value
228
- when /\AArray<(?<inner_type>.+)>\z/
229
- inner_type = Regexp.last_match[:inner_type]
230
- value.map { |v| _deserialize(inner_type, v) }
231
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
232
- k_type = Regexp.last_match[:k_type]
233
- v_type = Regexp.last_match[:v_type]
234
- {}.tap do |hash|
235
- value.each do |k, v|
236
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
237
- end
238
- end
239
- else # model
240
- temp_model = UltracartClient.const_get(type).new
241
- temp_model.build_from_hash(value)
242
- end
243
- end
244
-
245
- # Returns the string representation of the object
246
- # @return [String] String presentation of the object
247
- def to_s
248
- to_hash.to_s
249
- end
250
-
251
- # to_body is an alias to to_hash (backward compatibility)
252
- # @return [Hash] Returns the object in the form of hash
253
- def to_body
254
- to_hash
255
- end
256
-
257
- # Returns the object in the form of hash
258
- # @return [Hash] Returns the object in the form of hash
259
- def to_hash
260
- hash = {}
261
- self.class.attribute_map.each_pair do |attr, param|
262
- value = self.send(attr)
263
- next if value.nil?
264
- hash[param] = _to_hash(value)
265
- end
266
- hash
267
- end
268
-
269
- # Outputs non-array value in the form of hash
270
- # For object, use to_hash. Otherwise, just return the value
271
- # @param [Object] value Any valid value
272
- # @return [Hash] Returns the value in the form of hash
273
- def _to_hash(value)
274
- if value.is_a?(Array)
275
- value.compact.map { |v| _to_hash(v) }
276
- elsif value.is_a?(Hash)
277
- {}.tap do |hash|
278
- value.each { |k, v| hash[k] = _to_hash(v) }
279
- end
280
- elsif value.respond_to? :to_hash
281
- value.to_hash
282
- else
283
- value
284
- end
285
- end
286
-
287
- end
288
- end