wallee-ruby-sdk 0.0.0 → 1.0.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 +31 -0
- data/lib/wallee-ruby-sdk/version.rb +1 -1
- data/lib/wallee.rb +332 -0
- data/lib/wallee/api_client.rb +403 -0
- data/lib/wallee/api_error.rb +47 -0
- data/lib/wallee/configuration.rb +144 -0
- data/lib/wallee/models/account.rb +298 -0
- data/lib/wallee/models/account_create.rb +308 -0
- data/lib/wallee/models/account_state.rb +47 -0
- data/lib/wallee/models/account_type.rb +44 -0
- data/lib/wallee/models/account_update.rb +308 -0
- data/lib/wallee/models/address.rb +388 -0
- data/lib/wallee/models/address_create.rb +388 -0
- data/lib/wallee/models/application_user.rb +268 -0
- data/lib/wallee/models/application_user_create.rb +283 -0
- data/lib/wallee/models/application_user_create_with_mac_key.rb +278 -0
- data/lib/wallee/models/application_user_update.rb +278 -0
- data/lib/wallee/models/attachment_resource.rb +210 -0
- data/lib/wallee/models/charge.rb +318 -0
- data/lib/wallee/models/charge_attempt.rb +420 -0
- data/lib/wallee/models/charge_attempt_environment.rb +43 -0
- data/lib/wallee/models/charge_attempt_state.rb +44 -0
- data/lib/wallee/models/charge_flow.rb +270 -0
- data/lib/wallee/models/charge_flow_level.rb +318 -0
- data/lib/wallee/models/charge_flow_level_configuration.rb +288 -0
- data/lib/wallee/models/charge_flow_level_configuration_type.rb +222 -0
- data/lib/wallee/models/charge_flow_level_state.rb +44 -0
- data/lib/wallee/models/charge_state.rb +44 -0
- data/lib/wallee/models/charge_type.rb +44 -0
- data/lib/wallee/models/client_error.rb +238 -0
- data/lib/wallee/models/client_error_type.rb +44 -0
- data/lib/wallee/models/condition.rb +258 -0
- data/lib/wallee/models/condition_type.rb +222 -0
- data/lib/wallee/models/connector_invocation.rb +278 -0
- data/lib/wallee/models/connector_invocation_stage.rb +45 -0
- data/lib/wallee/models/creation_entity_state.rb +46 -0
- data/lib/wallee/models/criteria_operator.rb +50 -0
- data/lib/wallee/models/customers_presence.rb +44 -0
- data/lib/wallee/models/data_collection_type.rb +43 -0
- data/lib/wallee/models/database_translated_string.rb +222 -0
- data/lib/wallee/models/database_translated_string_create.rb +222 -0
- data/lib/wallee/models/database_translated_string_item.rb +218 -0
- data/lib/wallee/models/database_translated_string_item_create.rb +223 -0
- data/lib/wallee/models/delivery_indication.rb +318 -0
- data/lib/wallee/models/delivery_indication_decision_reason.rb +222 -0
- data/lib/wallee/models/delivery_indication_state.rb +45 -0
- data/lib/wallee/models/document_template.rb +278 -0
- data/lib/wallee/models/document_template_type.rb +242 -0
- data/lib/wallee/models/email_sender.rb +278 -0
- data/lib/wallee/models/email_sender_type.rb +232 -0
- data/lib/wallee/models/email_template.rb +324 -0
- data/lib/wallee/models/email_template_type.rb +288 -0
- data/lib/wallee/models/entity_query.rb +240 -0
- data/lib/wallee/models/entity_query_filter.rb +245 -0
- data/lib/wallee/models/entity_query_filter_type.rb +44 -0
- data/lib/wallee/models/entity_query_order_by.rb +208 -0
- data/lib/wallee/models/entity_query_order_by_type.rb +43 -0
- data/lib/wallee/models/entity_reference.rb +188 -0
- data/lib/wallee/models/failure_category.rb +46 -0
- data/lib/wallee/models/failure_reason.rb +244 -0
- data/lib/wallee/models/feature.rb +274 -0
- data/lib/wallee/models/gender.rb +43 -0
- data/lib/wallee/models/human_user.rb +318 -0
- data/lib/wallee/models/human_user_create.rb +328 -0
- data/lib/wallee/models/human_user_update.rb +328 -0
- data/lib/wallee/models/installment_calculated_plan.rb +242 -0
- data/lib/wallee/models/installment_calculated_slice.rb +220 -0
- data/lib/wallee/models/installment_payment.rb +280 -0
- data/lib/wallee/models/installment_payment_slice.rb +300 -0
- data/lib/wallee/models/installment_payment_slice_state.rb +48 -0
- data/lib/wallee/models/installment_payment_state.rb +49 -0
- data/lib/wallee/models/installment_plan_configuration.rb +362 -0
- data/lib/wallee/models/installment_plan_slice_configuration.rb +288 -0
- data/lib/wallee/models/label.rb +238 -0
- data/lib/wallee/models/label_descriptor.rb +274 -0
- data/lib/wallee/models/label_descriptor_category.rb +43 -0
- data/lib/wallee/models/label_descriptor_group.rb +232 -0
- data/lib/wallee/models/label_descriptor_type.rb +222 -0
- data/lib/wallee/models/legal_organization_form.rb +242 -0
- data/lib/wallee/models/line_item.rb +342 -0
- data/lib/wallee/models/line_item_attribute.rb +208 -0
- data/lib/wallee/models/line_item_attribute_create.rb +208 -0
- data/lib/wallee/models/line_item_create.rb +367 -0
- data/lib/wallee/models/line_item_reduction.rb +218 -0
- data/lib/wallee/models/line_item_reduction_create.rb +233 -0
- data/lib/wallee/models/line_item_type.rb +45 -0
- data/lib/wallee/models/localized_string.rb +218 -0
- data/lib/wallee/models/manual_task.rb +290 -0
- data/lib/wallee/models/manual_task_action.rb +230 -0
- data/lib/wallee/models/manual_task_action_style.rb +44 -0
- data/lib/wallee/models/manual_task_state.rb +44 -0
- data/lib/wallee/models/manual_task_type.rb +234 -0
- data/lib/wallee/models/one_click_payment_mode.rb +44 -0
- data/lib/wallee/models/payment_connector.rb +306 -0
- data/lib/wallee/models/payment_connector_configuration.rb +322 -0
- data/lib/wallee/models/payment_connector_feature.rb +218 -0
- data/lib/wallee/models/payment_method.rb +256 -0
- data/lib/wallee/models/payment_method_brand.rb +252 -0
- data/lib/wallee/models/payment_method_configuration.rb +328 -0
- data/lib/wallee/models/payment_primary_risk_taker.rb +44 -0
- data/lib/wallee/models/payment_processor.rb +278 -0
- data/lib/wallee/models/payment_processor_configuration.rb +258 -0
- data/lib/wallee/models/permission.rb +286 -0
- data/lib/wallee/models/persistable_currency_amount.rb +208 -0
- data/lib/wallee/models/persistable_currency_amount_update.rb +208 -0
- data/lib/wallee/models/product_fee_type.rb +44 -0
- data/lib/wallee/models/product_metered_fee.rb +278 -0
- data/lib/wallee/models/product_metered_fee_update.rb +288 -0
- data/lib/wallee/models/product_metered_tier_fee.rb +240 -0
- data/lib/wallee/models/product_metered_tier_fee_update.rb +250 -0
- data/lib/wallee/models/product_metered_tier_pricing.rb +43 -0
- data/lib/wallee/models/product_period_fee.rb +280 -0
- data/lib/wallee/models/product_period_fee_update.rb +290 -0
- data/lib/wallee/models/product_setup_fee.rb +294 -0
- data/lib/wallee/models/product_setup_fee_update.rb +304 -0
- data/lib/wallee/models/refund.rb +450 -0
- data/lib/wallee/models/refund_create.rb +470 -0
- data/lib/wallee/models/refund_state.rb +46 -0
- data/lib/wallee/models/refund_type.rb +45 -0
- data/lib/wallee/models/rendered_document.rb +230 -0
- data/lib/wallee/models/resource_path.rb +258 -0
- data/lib/wallee/models/resource_state.rb +44 -0
- data/lib/wallee/models/rest_country.rb +240 -0
- data/lib/wallee/models/rest_country_state.rb +228 -0
- data/lib/wallee/models/rest_currency.rb +218 -0
- data/lib/wallee/models/rest_language.rb +248 -0
- data/lib/wallee/models/scope.rb +302 -0
- data/lib/wallee/models/server_error.rb +218 -0
- data/lib/wallee/models/space.rb +330 -0
- data/lib/wallee/models/space_address.rb +318 -0
- data/lib/wallee/models/space_address_setter.rb +318 -0
- data/lib/wallee/models/space_create.rb +350 -0
- data/lib/wallee/models/space_reference.rb +258 -0
- data/lib/wallee/models/space_reference_state.rb +46 -0
- data/lib/wallee/models/space_update.rb +340 -0
- data/lib/wallee/models/space_view.rb +258 -0
- data/lib/wallee/models/static_value.rb +234 -0
- data/lib/wallee/models/subscriber.rb +332 -0
- data/lib/wallee/models/subscriber_active.rb +342 -0
- data/lib/wallee/models/subscriber_create.rb +347 -0
- data/lib/wallee/models/subscriber_update.rb +342 -0
- data/lib/wallee/models/subscription.rb +338 -0
- data/lib/wallee/models/subscription_change_request.rb +250 -0
- data/lib/wallee/models/subscription_charge.rb +390 -0
- data/lib/wallee/models/subscription_charge_create.rb +405 -0
- data/lib/wallee/models/subscription_charge_processing_type.rb +43 -0
- data/lib/wallee/models/subscription_charge_state.rb +46 -0
- data/lib/wallee/models/subscription_charge_type.rb +43 -0
- data/lib/wallee/models/subscription_create_request.rb +245 -0
- data/lib/wallee/models/subscription_ledger_entry.rb +350 -0
- data/lib/wallee/models/subscription_ledger_entry_create.rb +375 -0
- data/lib/wallee/models/subscription_ledger_entry_state.rb +44 -0
- data/lib/wallee/models/subscription_metric.rb +268 -0
- data/lib/wallee/models/subscription_metric_active.rb +278 -0
- data/lib/wallee/models/subscription_metric_create.rb +288 -0
- data/lib/wallee/models/subscription_metric_type.rb +232 -0
- data/lib/wallee/models/subscription_metric_update.rb +278 -0
- data/lib/wallee/models/subscription_metric_usage_report.rb +298 -0
- data/lib/wallee/models/subscription_metric_usage_report_create.rb +318 -0
- data/lib/wallee/models/subscription_pending.rb +348 -0
- data/lib/wallee/models/subscription_period_bill.rb +298 -0
- data/lib/wallee/models/subscription_period_bill_state.rb +43 -0
- data/lib/wallee/models/subscription_product.rb +300 -0
- data/lib/wallee/models/subscription_product_active.rb +310 -0
- data/lib/wallee/models/subscription_product_component.rb +298 -0
- data/lib/wallee/models/subscription_product_component_group.rb +258 -0
- data/lib/wallee/models/subscription_product_component_group_update.rb +268 -0
- data/lib/wallee/models/subscription_product_component_reference.rb +258 -0
- data/lib/wallee/models/subscription_product_component_reference_state.rb +45 -0
- data/lib/wallee/models/subscription_product_component_update.rb +308 -0
- data/lib/wallee/models/subscription_product_create.rb +315 -0
- data/lib/wallee/models/subscription_product_retirement.rb +258 -0
- data/lib/wallee/models/subscription_product_retirement_create.rb +263 -0
- data/lib/wallee/models/subscription_product_state.rb +46 -0
- data/lib/wallee/models/subscription_product_version.rb +390 -0
- data/lib/wallee/models/subscription_product_version_pending.rb +310 -0
- data/lib/wallee/models/subscription_product_version_retirement.rb +258 -0
- data/lib/wallee/models/subscription_product_version_retirement_create.rb +263 -0
- data/lib/wallee/models/subscription_product_version_state.rb +46 -0
- data/lib/wallee/models/subscription_state.rb +48 -0
- data/lib/wallee/models/subscription_suspension.rb +328 -0
- data/lib/wallee/models/subscription_suspension_action.rb +43 -0
- data/lib/wallee/models/subscription_suspension_create.rb +343 -0
- data/lib/wallee/models/subscription_suspension_reason.rb +44 -0
- data/lib/wallee/models/subscription_suspension_running.rb +328 -0
- data/lib/wallee/models/subscription_suspension_state.rb +43 -0
- data/lib/wallee/models/subscription_update.rb +348 -0
- data/lib/wallee/models/subscription_version.rb +370 -0
- data/lib/wallee/models/subscription_version_state.rb +47 -0
- data/lib/wallee/models/tax.rb +208 -0
- data/lib/wallee/models/tax_class.rb +258 -0
- data/lib/wallee/models/tax_create.rb +218 -0
- data/lib/wallee/models/tenant_database.rb +218 -0
- data/lib/wallee/models/token.rb +308 -0
- data/lib/wallee/models/token_create.rb +323 -0
- data/lib/wallee/models/token_update.rb +318 -0
- data/lib/wallee/models/token_version.rb +360 -0
- data/lib/wallee/models/token_version_state.rb +44 -0
- data/lib/wallee/models/transaction.rb +626 -0
- data/lib/wallee/models/transaction_aware_entity.rb +218 -0
- data/lib/wallee/models/transaction_completion.rb +390 -0
- data/lib/wallee/models/transaction_completion_mode.rb +44 -0
- data/lib/wallee/models/transaction_completion_state.rb +45 -0
- data/lib/wallee/models/transaction_create.rb +646 -0
- data/lib/wallee/models/transaction_group.rb +268 -0
- data/lib/wallee/models/transaction_group_state.rb +44 -0
- data/lib/wallee/models/transaction_invoice.rb +380 -0
- data/lib/wallee/models/transaction_invoice_replacement.rb +250 -0
- data/lib/wallee/models/transaction_invoice_state.rb +48 -0
- data/lib/wallee/models/transaction_line_item_update_request.rb +215 -0
- data/lib/wallee/models/transaction_line_item_version.rb +320 -0
- data/lib/wallee/models/transaction_pending.rb +636 -0
- data/lib/wallee/models/transaction_state.rb +51 -0
- data/lib/wallee/models/transaction_user_interface_type.rb +44 -0
- data/lib/wallee/models/transaction_void.rb +380 -0
- data/lib/wallee/models/transaction_void_mode.rb +43 -0
- data/lib/wallee/models/transaction_void_state.rb +45 -0
- data/lib/wallee/models/user.rb +248 -0
- data/lib/wallee/models/user_type.rb +45 -0
- data/lib/wallee/models/webhook_identity.rb +248 -0
- data/lib/wallee/models/webhook_listener.rb +300 -0
- data/lib/wallee/models/webhook_listener_create.rb +330 -0
- data/lib/wallee/models/webhook_listener_entity.rb +220 -0
- data/lib/wallee/models/webhook_listener_update.rb +310 -0
- data/lib/wallee/models/webhook_url.rb +258 -0
- data/lib/wallee/models/webhook_url_create.rb +273 -0
- data/lib/wallee/models/webhook_url_update.rb +268 -0
- data/lib/wallee/services/account_service_api.rb +372 -0
- data/lib/wallee/services/application_user_service_api.rb +372 -0
- data/lib/wallee/services/charge_attempt_service_api.rb +217 -0
- data/lib/wallee/services/charge_flow_level_service_api.rb +280 -0
- data/lib/wallee/services/charge_flow_service_api.rb +352 -0
- data/lib/wallee/services/condition_type_service_api.rb +143 -0
- data/lib/wallee/services/country_service_api.rb +85 -0
- data/lib/wallee/services/country_state_service_api.rb +143 -0
- data/lib/wallee/services/currency_service_api.rb +85 -0
- data/lib/wallee/services/delivery_indication_service_api.rb +341 -0
- data/lib/wallee/services/document_template_service_api.rb +217 -0
- data/lib/wallee/services/document_template_type_service_api.rb +143 -0
- data/lib/wallee/services/email_sender_service_api.rb +219 -0
- data/lib/wallee/services/email_sender_type_service_api.rb +143 -0
- data/lib/wallee/services/email_template_service_api.rb +217 -0
- data/lib/wallee/services/email_template_type_service_api.rb +143 -0
- data/lib/wallee/services/human_user_service_api.rb +372 -0
- data/lib/wallee/services/installment_payment_service_api.rb +287 -0
- data/lib/wallee/services/installment_payment_slice_service_api.rb +219 -0
- data/lib/wallee/services/installment_plan_calculation_service_api.rb +95 -0
- data/lib/wallee/services/installment_plan_configuration_service_api.rb +219 -0
- data/lib/wallee/services/installment_plan_slice_configuration_service_api.rb +219 -0
- data/lib/wallee/services/label_description_group_service_api.rb +143 -0
- data/lib/wallee/services/label_description_service_api.rb +143 -0
- data/lib/wallee/services/language_service_api.rb +85 -0
- data/lib/wallee/services/manual_task_service_api.rb +217 -0
- data/lib/wallee/services/payment_connector_configuration_service_api.rb +217 -0
- data/lib/wallee/services/payment_connector_service_api.rb +143 -0
- data/lib/wallee/services/payment_method_configuration_service_api.rb +217 -0
- data/lib/wallee/services/payment_method_service_api.rb +143 -0
- data/lib/wallee/services/payment_processor_configuration_service_api.rb +217 -0
- data/lib/wallee/services/payment_processor_service_api.rb +143 -0
- data/lib/wallee/services/permission_service_api.rb +143 -0
- data/lib/wallee/services/refund_service_api.rb +468 -0
- data/lib/wallee/services/space_service_api.rb +372 -0
- data/lib/wallee/services/static_value_service_api.rb +143 -0
- data/lib/wallee/services/subscriber_service_api.rb +402 -0
- data/lib/wallee/services/subscription_charge_service_api.rb +342 -0
- data/lib/wallee/services/subscription_ledger_entry_service_api.rb +279 -0
- data/lib/wallee/services/subscription_metric_service_api.rb +402 -0
- data/lib/wallee/services/subscription_metric_usage_service_api.rb +279 -0
- data/lib/wallee/services/subscription_period_bill_service_api.rb +217 -0
- data/lib/wallee/services/subscription_product_component_group_service_api.rb +402 -0
- data/lib/wallee/services/subscription_product_component_service_api.rb +402 -0
- data/lib/wallee/services/subscription_product_fee_tier_service_api.rb +402 -0
- data/lib/wallee/services/subscription_product_metered_fee_service_api.rb +402 -0
- data/lib/wallee/services/subscription_product_period_fee_service_api.rb +402 -0
- data/lib/wallee/services/subscription_product_retirement_service_api.rb +279 -0
- data/lib/wallee/services/subscription_product_service_api.rb +341 -0
- data/lib/wallee/services/subscription_product_setup_fee_service_api.rb +402 -0
- data/lib/wallee/services/subscription_product_version_retirement_service_api.rb +279 -0
- data/lib/wallee/services/subscription_product_version_service_api.rb +404 -0
- data/lib/wallee/services/subscription_service_api.rb +608 -0
- data/lib/wallee/services/subscription_suspension_service_api.rb +342 -0
- data/lib/wallee/services/subscription_version_service_api.rb +217 -0
- data/lib/wallee/services/token_service_api.rb +402 -0
- data/lib/wallee/services/token_version_service_api.rb +280 -0
- data/lib/wallee/services/transaction_completion_service_api.rb +343 -0
- data/lib/wallee/services/transaction_invoice_service_api.rb +473 -0
- data/lib/wallee/services/transaction_service_api.rb +1263 -0
- data/lib/wallee/services/transaction_void_service_api.rb +343 -0
- data/lib/wallee/services/webhook_listener_service_api.rb +402 -0
- data/lib/wallee/services/webhook_url_service_api.rb +402 -0
- data/lib/wallee/version.rb +24 -0
- metadata +292 -2
@@ -0,0 +1,45 @@
|
|
1
|
+
=begin
|
2
|
+
Wallee API: 1.0.0
|
3
|
+
|
4
|
+
The wallee API allows an easy interaction with the wallee web service.
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
you may not use this file except in compliance with the License.
|
10
|
+
You may obtain a copy of the License at
|
11
|
+
|
12
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
See the License for the specific language governing permissions and
|
18
|
+
limitations under the License.
|
19
|
+
|
20
|
+
=end
|
21
|
+
|
22
|
+
require 'date'
|
23
|
+
|
24
|
+
module Wallee
|
25
|
+
class SubscriptionProductComponentReferenceState
|
26
|
+
|
27
|
+
CREATE = "CREATE".freeze
|
28
|
+
ACTIVE = "ACTIVE".freeze
|
29
|
+
DELETING = "DELETING".freeze
|
30
|
+
DELETED = "DELETED".freeze
|
31
|
+
|
32
|
+
# Builds the object from hash
|
33
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
34
|
+
# @return [Object] Returns the model itself
|
35
|
+
def build_from_hash(value)
|
36
|
+
|
37
|
+
consantValues = SubscriptionProductComponentReferenceState.constants.select{|c| c.to_s == value}
|
38
|
+
raise "Invalid ENUM value #{value} for class #SubscriptionProductComponentReferenceState" if consantValues.empty?
|
39
|
+
|
40
|
+
value
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,308 @@
|
|
1
|
+
=begin
|
2
|
+
Wallee API: 1.0.0
|
3
|
+
|
4
|
+
The wallee API allows an easy interaction with the wallee web service.
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
you may not use this file except in compliance with the License.
|
10
|
+
You may obtain a copy of the License at
|
11
|
+
|
12
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
See the License for the specific language governing permissions and
|
18
|
+
limitations under the License.
|
19
|
+
|
20
|
+
=end
|
21
|
+
|
22
|
+
require 'date'
|
23
|
+
|
24
|
+
module Wallee
|
25
|
+
#
|
26
|
+
class SubscriptionProductComponentUpdate
|
27
|
+
# The change weight determines whether if a component change is considered as upgrade or downgrade. If product component with a weight 10 is changed to a product component with a weight 20, the change is considered as upgrade. On the other hand a change from 20 to 10 is considered as a downgrade.
|
28
|
+
attr_accessor :component_change_weight
|
29
|
+
|
30
|
+
#
|
31
|
+
attr_accessor :component_group
|
32
|
+
|
33
|
+
# When a component is marked as a 'default' component it is used when no other component is selected by the user.
|
34
|
+
attr_accessor :default_component
|
35
|
+
|
36
|
+
# The component description may contain a longer description which gives the subscriber a better understanding of what the component contains.
|
37
|
+
attr_accessor :description
|
38
|
+
|
39
|
+
# The ID is the primary key of the entity. The ID identifies the entity uniquely.
|
40
|
+
attr_accessor :id
|
41
|
+
|
42
|
+
# The linked space id holds the ID of the space to which the entity belongs to.
|
43
|
+
attr_accessor :linked_space_id
|
44
|
+
|
45
|
+
# The component name is shown to the subscriber. It should describe in few words what the component does contain.
|
46
|
+
attr_accessor :name
|
47
|
+
|
48
|
+
# The component reference is used to identify the component by external systems and it marks components to represent the same component within different product versions.
|
49
|
+
attr_accessor :reference
|
50
|
+
|
51
|
+
# The sort order controls in which order the component is listed. The sort order is used to order the components in ascending order.
|
52
|
+
attr_accessor :sort_order
|
53
|
+
|
54
|
+
# The tax class of the component determines the taxes which are applicable on all fees linked with the component.
|
55
|
+
attr_accessor :tax_class
|
56
|
+
|
57
|
+
# The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
|
58
|
+
attr_accessor :version
|
59
|
+
|
60
|
+
|
61
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
62
|
+
def self.attribute_map
|
63
|
+
{
|
64
|
+
:'component_change_weight' => :'componentChangeWeight',
|
65
|
+
:'component_group' => :'componentGroup',
|
66
|
+
:'default_component' => :'defaultComponent',
|
67
|
+
:'description' => :'description',
|
68
|
+
:'id' => :'id',
|
69
|
+
:'linked_space_id' => :'linkedSpaceId',
|
70
|
+
:'name' => :'name',
|
71
|
+
:'reference' => :'reference',
|
72
|
+
:'sort_order' => :'sortOrder',
|
73
|
+
:'tax_class' => :'taxClass',
|
74
|
+
:'version' => :'version'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# Attribute type mapping.
|
79
|
+
def self.swagger_types
|
80
|
+
{
|
81
|
+
:'component_change_weight' => :'Integer',
|
82
|
+
:'component_group' => :'Integer',
|
83
|
+
:'default_component' => :'BOOLEAN',
|
84
|
+
:'description' => :'DatabaseTranslatedStringCreate',
|
85
|
+
:'id' => :'Integer',
|
86
|
+
:'linked_space_id' => :'Integer',
|
87
|
+
:'name' => :'DatabaseTranslatedStringCreate',
|
88
|
+
:'reference' => :'Integer',
|
89
|
+
:'sort_order' => :'Integer',
|
90
|
+
:'tax_class' => :'Integer',
|
91
|
+
:'version' => :'Integer'
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
# Initializes the object
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
def initialize(attributes = {})
|
98
|
+
return unless attributes.is_a?(Hash)
|
99
|
+
|
100
|
+
# convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
102
|
+
|
103
|
+
if attributes.has_key?(:'componentChangeWeight')
|
104
|
+
self.component_change_weight = attributes[:'componentChangeWeight']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'componentGroup')
|
108
|
+
self.component_group = attributes[:'componentGroup']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'defaultComponent')
|
112
|
+
self.default_component = attributes[:'defaultComponent']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'description')
|
116
|
+
self.description = attributes[:'description']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.has_key?(:'id')
|
120
|
+
self.id = attributes[:'id']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.has_key?(:'linkedSpaceId')
|
124
|
+
self.linked_space_id = attributes[:'linkedSpaceId']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'name')
|
128
|
+
self.name = attributes[:'name']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'reference')
|
132
|
+
self.reference = attributes[:'reference']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.has_key?(:'sortOrder')
|
136
|
+
self.sort_order = attributes[:'sortOrder']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.has_key?(:'taxClass')
|
140
|
+
self.tax_class = attributes[:'taxClass']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'version')
|
144
|
+
self.version = attributes[:'version']
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
150
|
+
# @return Array for valid properies with the reasons
|
151
|
+
def list_invalid_properties
|
152
|
+
invalid_properties = Array.new
|
153
|
+
if @id.nil?
|
154
|
+
invalid_properties.push("invalid value for 'id', id cannot be nil.")
|
155
|
+
end
|
156
|
+
|
157
|
+
if @version.nil?
|
158
|
+
invalid_properties.push("invalid value for 'version', version cannot be nil.")
|
159
|
+
end
|
160
|
+
|
161
|
+
return invalid_properties
|
162
|
+
end
|
163
|
+
|
164
|
+
# Check to see if the all the properties in the model are valid
|
165
|
+
# @return true if the model is valid
|
166
|
+
def valid?
|
167
|
+
return false if @id.nil?
|
168
|
+
return false if @version.nil?
|
169
|
+
return true
|
170
|
+
end
|
171
|
+
|
172
|
+
# Checks equality by comparing each attribute.
|
173
|
+
# @param [Object] Object to be compared
|
174
|
+
def ==(o)
|
175
|
+
return true if self.equal?(o)
|
176
|
+
self.class == o.class &&
|
177
|
+
component_change_weight == o.component_change_weight &&
|
178
|
+
component_group == o.component_group &&
|
179
|
+
default_component == o.default_component &&
|
180
|
+
description == o.description &&
|
181
|
+
id == o.id &&
|
182
|
+
linked_space_id == o.linked_space_id &&
|
183
|
+
name == o.name &&
|
184
|
+
reference == o.reference &&
|
185
|
+
sort_order == o.sort_order &&
|
186
|
+
tax_class == o.tax_class &&
|
187
|
+
version == o.version
|
188
|
+
end
|
189
|
+
|
190
|
+
# @see the `==` method
|
191
|
+
# @param [Object] Object to be compared
|
192
|
+
def eql?(o)
|
193
|
+
self == o
|
194
|
+
end
|
195
|
+
|
196
|
+
# Calculates hash code according to all attributes.
|
197
|
+
# @return [Fixnum] Hash code
|
198
|
+
def hash
|
199
|
+
[component_change_weight, component_group, default_component, description, id, linked_space_id, name, reference, sort_order, tax_class, version].hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Builds the object from hash
|
203
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
204
|
+
# @return [Object] Returns the model itself
|
205
|
+
def build_from_hash(attributes)
|
206
|
+
return nil unless attributes.is_a?(Hash)
|
207
|
+
self.class.swagger_types.each_pair do |key, type|
|
208
|
+
if type =~ /\AArray<(.*)>/i
|
209
|
+
# check to ensure the input is an array given that the the attribute
|
210
|
+
# is documented as an array but the input is not
|
211
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
212
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
213
|
+
end
|
214
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
215
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
216
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
217
|
+
end
|
218
|
+
|
219
|
+
self
|
220
|
+
end
|
221
|
+
|
222
|
+
# Deserializes the data based on type
|
223
|
+
# @param string type Data type
|
224
|
+
# @param string value Value to be deserialized
|
225
|
+
# @return [Object] Deserialized data
|
226
|
+
def _deserialize(type, value)
|
227
|
+
case type.to_sym
|
228
|
+
when :DateTime
|
229
|
+
DateTime.parse(value)
|
230
|
+
when :Date
|
231
|
+
Date.parse(value)
|
232
|
+
when :String
|
233
|
+
value.to_s
|
234
|
+
when :Integer
|
235
|
+
value.to_i
|
236
|
+
when :Float
|
237
|
+
value.to_f
|
238
|
+
when :BOOLEAN
|
239
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
240
|
+
true
|
241
|
+
else
|
242
|
+
false
|
243
|
+
end
|
244
|
+
when :Object
|
245
|
+
# generic object (usually a Hash), return directly
|
246
|
+
value
|
247
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
248
|
+
inner_type = Regexp.last_match[:inner_type]
|
249
|
+
value.map { |v| _deserialize(inner_type, v) }
|
250
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
251
|
+
k_type = Regexp.last_match[:k_type]
|
252
|
+
v_type = Regexp.last_match[:v_type]
|
253
|
+
{}.tap do |hash|
|
254
|
+
value.each do |k, v|
|
255
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
else # model
|
259
|
+
temp_model = Wallee.const_get(type).new
|
260
|
+
temp_model.build_from_hash(value)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# Returns the string representation of the object
|
265
|
+
# @return [String] String presentation of the object
|
266
|
+
def to_s
|
267
|
+
to_hash.to_s
|
268
|
+
end
|
269
|
+
|
270
|
+
# to_body is an alias to to_hash (backward compatibility)
|
271
|
+
# @return [Hash] Returns the object in the form of hash
|
272
|
+
def to_body
|
273
|
+
to_hash
|
274
|
+
end
|
275
|
+
|
276
|
+
# Returns the object in the form of hash
|
277
|
+
# @return [Hash] Returns the object in the form of hash
|
278
|
+
def to_hash
|
279
|
+
hash = {}
|
280
|
+
self.class.attribute_map.each_pair do |attr, param|
|
281
|
+
value = self.send(attr)
|
282
|
+
next if value.nil?
|
283
|
+
hash[param] = _to_hash(value)
|
284
|
+
end
|
285
|
+
hash
|
286
|
+
end
|
287
|
+
|
288
|
+
# Outputs non-array value in the form of hash
|
289
|
+
# For object, use to_hash. Otherwise, just return the value
|
290
|
+
# @param [Object] value Any valid value
|
291
|
+
# @return [Hash] Returns the value in the form of hash
|
292
|
+
def _to_hash(value)
|
293
|
+
if value.is_a?(Array)
|
294
|
+
value.compact.map{ |v| _to_hash(v) }
|
295
|
+
elsif value.is_a?(Hash)
|
296
|
+
{}.tap do |hash|
|
297
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
298
|
+
end
|
299
|
+
elsif value.respond_to? :to_hash
|
300
|
+
value.to_hash
|
301
|
+
else
|
302
|
+
value
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|
307
|
+
|
308
|
+
end
|
@@ -0,0 +1,315 @@
|
|
1
|
+
=begin
|
2
|
+
Wallee API: 1.0.0
|
3
|
+
|
4
|
+
The wallee API allows an easy interaction with the wallee web service.
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
you may not use this file except in compliance with the License.
|
10
|
+
You may obtain a copy of the License at
|
11
|
+
|
12
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
See the License for the specific language governing permissions and
|
18
|
+
limitations under the License.
|
19
|
+
|
20
|
+
=end
|
21
|
+
|
22
|
+
require 'date'
|
23
|
+
|
24
|
+
module Wallee
|
25
|
+
# A subscription product represents a product to which a subscriber can subscribe to. A product defines how much the subscription costs and in what cycles the subscribe is charged.
|
26
|
+
class SubscriptionProductCreate
|
27
|
+
# The allowed payment method configurations control which payment methods can be used with this product. When none is selected all methods will be allowed.
|
28
|
+
attr_accessor :allowed_payment_method_configurations
|
29
|
+
|
30
|
+
# When a payment fails, the subscription to which the payment belongs to will be suspended. When the suspension is not removed within the specified period the subscription will be terminated. A payment is considered as failed when the subscriber issues a refund or when a subscription charge fails.
|
31
|
+
attr_accessor :failed_payment_suspension_period
|
32
|
+
|
33
|
+
# The ID is the primary key of the entity. The ID identifies the entity uniquely.
|
34
|
+
attr_accessor :id
|
35
|
+
|
36
|
+
# The linked space id holds the ID of the space to which the entity belongs to.
|
37
|
+
attr_accessor :linked_space_id
|
38
|
+
|
39
|
+
# The product name is used internally to identify the configuration in administrative interfaces. For example it is used within search fields and hence it should be distinct and descriptive.
|
40
|
+
attr_accessor :name
|
41
|
+
|
42
|
+
# The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
|
43
|
+
attr_accessor :planned_purge_date
|
44
|
+
|
45
|
+
# The product reference identifies the product for external systems. This field may contain the product's SKU.
|
46
|
+
attr_accessor :reference
|
47
|
+
|
48
|
+
# The sort order controls in which order the product is listed. The sort order is used to order the products in ascending order.
|
49
|
+
attr_accessor :sort_order
|
50
|
+
|
51
|
+
#
|
52
|
+
attr_accessor :space_id
|
53
|
+
|
54
|
+
#
|
55
|
+
attr_accessor :state
|
56
|
+
|
57
|
+
# The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
|
58
|
+
attr_accessor :version
|
59
|
+
|
60
|
+
|
61
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
62
|
+
def self.attribute_map
|
63
|
+
{
|
64
|
+
:'allowed_payment_method_configurations' => :'allowedPaymentMethodConfigurations',
|
65
|
+
:'failed_payment_suspension_period' => :'failedPaymentSuspensionPeriod',
|
66
|
+
:'id' => :'id',
|
67
|
+
:'linked_space_id' => :'linkedSpaceId',
|
68
|
+
:'name' => :'name',
|
69
|
+
:'planned_purge_date' => :'plannedPurgeDate',
|
70
|
+
:'reference' => :'reference',
|
71
|
+
:'sort_order' => :'sortOrder',
|
72
|
+
:'space_id' => :'spaceId',
|
73
|
+
:'state' => :'state',
|
74
|
+
:'version' => :'version'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# Attribute type mapping.
|
79
|
+
def self.swagger_types
|
80
|
+
{
|
81
|
+
:'allowed_payment_method_configurations' => :'Array<Integer>',
|
82
|
+
:'failed_payment_suspension_period' => :'String',
|
83
|
+
:'id' => :'Integer',
|
84
|
+
:'linked_space_id' => :'Integer',
|
85
|
+
:'name' => :'String',
|
86
|
+
:'planned_purge_date' => :'DateTime',
|
87
|
+
:'reference' => :'String',
|
88
|
+
:'sort_order' => :'Integer',
|
89
|
+
:'space_id' => :'Integer',
|
90
|
+
:'state' => :'SubscriptionProductState',
|
91
|
+
:'version' => :'Integer'
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
# Initializes the object
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
def initialize(attributes = {})
|
98
|
+
return unless attributes.is_a?(Hash)
|
99
|
+
|
100
|
+
# convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
102
|
+
|
103
|
+
if attributes.has_key?(:'allowedPaymentMethodConfigurations')
|
104
|
+
if (value = attributes[:'allowedPaymentMethodConfigurations']).is_a?(Array)
|
105
|
+
self.allowed_payment_method_configurations = value
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'failedPaymentSuspensionPeriod')
|
110
|
+
self.failed_payment_suspension_period = attributes[:'failedPaymentSuspensionPeriod']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'id')
|
114
|
+
self.id = attributes[:'id']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'linkedSpaceId')
|
118
|
+
self.linked_space_id = attributes[:'linkedSpaceId']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'name')
|
122
|
+
self.name = attributes[:'name']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'plannedPurgeDate')
|
126
|
+
self.planned_purge_date = attributes[:'plannedPurgeDate']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'reference')
|
130
|
+
self.reference = attributes[:'reference']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'sortOrder')
|
134
|
+
self.sort_order = attributes[:'sortOrder']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'spaceId')
|
138
|
+
self.space_id = attributes[:'spaceId']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'state')
|
142
|
+
self.state = attributes[:'state']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.has_key?(:'version')
|
146
|
+
self.version = attributes[:'version']
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
152
|
+
# @return Array for valid properies with the reasons
|
153
|
+
def list_invalid_properties
|
154
|
+
invalid_properties = Array.new
|
155
|
+
if @id.nil?
|
156
|
+
invalid_properties.push("invalid value for 'id', id cannot be nil.")
|
157
|
+
end
|
158
|
+
|
159
|
+
if @reference.nil?
|
160
|
+
invalid_properties.push("invalid value for 'reference', reference cannot be nil.")
|
161
|
+
end
|
162
|
+
|
163
|
+
if @version.nil?
|
164
|
+
invalid_properties.push("invalid value for 'version', version cannot be nil.")
|
165
|
+
end
|
166
|
+
|
167
|
+
return invalid_properties
|
168
|
+
end
|
169
|
+
|
170
|
+
# Check to see if the all the properties in the model are valid
|
171
|
+
# @return true if the model is valid
|
172
|
+
def valid?
|
173
|
+
return false if @id.nil?
|
174
|
+
return false if @reference.nil?
|
175
|
+
return false if @version.nil?
|
176
|
+
return true
|
177
|
+
end
|
178
|
+
|
179
|
+
# Checks equality by comparing each attribute.
|
180
|
+
# @param [Object] Object to be compared
|
181
|
+
def ==(o)
|
182
|
+
return true if self.equal?(o)
|
183
|
+
self.class == o.class &&
|
184
|
+
allowed_payment_method_configurations == o.allowed_payment_method_configurations &&
|
185
|
+
failed_payment_suspension_period == o.failed_payment_suspension_period &&
|
186
|
+
id == o.id &&
|
187
|
+
linked_space_id == o.linked_space_id &&
|
188
|
+
name == o.name &&
|
189
|
+
planned_purge_date == o.planned_purge_date &&
|
190
|
+
reference == o.reference &&
|
191
|
+
sort_order == o.sort_order &&
|
192
|
+
space_id == o.space_id &&
|
193
|
+
state == o.state &&
|
194
|
+
version == o.version
|
195
|
+
end
|
196
|
+
|
197
|
+
# @see the `==` method
|
198
|
+
# @param [Object] Object to be compared
|
199
|
+
def eql?(o)
|
200
|
+
self == o
|
201
|
+
end
|
202
|
+
|
203
|
+
# Calculates hash code according to all attributes.
|
204
|
+
# @return [Fixnum] Hash code
|
205
|
+
def hash
|
206
|
+
[allowed_payment_method_configurations, failed_payment_suspension_period, id, linked_space_id, name, planned_purge_date, reference, sort_order, space_id, state, version].hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Builds the object from hash
|
210
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
211
|
+
# @return [Object] Returns the model itself
|
212
|
+
def build_from_hash(attributes)
|
213
|
+
return nil unless attributes.is_a?(Hash)
|
214
|
+
self.class.swagger_types.each_pair do |key, type|
|
215
|
+
if type =~ /\AArray<(.*)>/i
|
216
|
+
# check to ensure the input is an array given that the the attribute
|
217
|
+
# is documented as an array but the input is not
|
218
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
219
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
220
|
+
end
|
221
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
222
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
223
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
224
|
+
end
|
225
|
+
|
226
|
+
self
|
227
|
+
end
|
228
|
+
|
229
|
+
# Deserializes the data based on type
|
230
|
+
# @param string type Data type
|
231
|
+
# @param string value Value to be deserialized
|
232
|
+
# @return [Object] Deserialized data
|
233
|
+
def _deserialize(type, value)
|
234
|
+
case type.to_sym
|
235
|
+
when :DateTime
|
236
|
+
DateTime.parse(value)
|
237
|
+
when :Date
|
238
|
+
Date.parse(value)
|
239
|
+
when :String
|
240
|
+
value.to_s
|
241
|
+
when :Integer
|
242
|
+
value.to_i
|
243
|
+
when :Float
|
244
|
+
value.to_f
|
245
|
+
when :BOOLEAN
|
246
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
247
|
+
true
|
248
|
+
else
|
249
|
+
false
|
250
|
+
end
|
251
|
+
when :Object
|
252
|
+
# generic object (usually a Hash), return directly
|
253
|
+
value
|
254
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
255
|
+
inner_type = Regexp.last_match[:inner_type]
|
256
|
+
value.map { |v| _deserialize(inner_type, v) }
|
257
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
258
|
+
k_type = Regexp.last_match[:k_type]
|
259
|
+
v_type = Regexp.last_match[:v_type]
|
260
|
+
{}.tap do |hash|
|
261
|
+
value.each do |k, v|
|
262
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
else # model
|
266
|
+
temp_model = Wallee.const_get(type).new
|
267
|
+
temp_model.build_from_hash(value)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# Returns the string representation of the object
|
272
|
+
# @return [String] String presentation of the object
|
273
|
+
def to_s
|
274
|
+
to_hash.to_s
|
275
|
+
end
|
276
|
+
|
277
|
+
# to_body is an alias to to_hash (backward compatibility)
|
278
|
+
# @return [Hash] Returns the object in the form of hash
|
279
|
+
def to_body
|
280
|
+
to_hash
|
281
|
+
end
|
282
|
+
|
283
|
+
# Returns the object in the form of hash
|
284
|
+
# @return [Hash] Returns the object in the form of hash
|
285
|
+
def to_hash
|
286
|
+
hash = {}
|
287
|
+
self.class.attribute_map.each_pair do |attr, param|
|
288
|
+
value = self.send(attr)
|
289
|
+
next if value.nil?
|
290
|
+
hash[param] = _to_hash(value)
|
291
|
+
end
|
292
|
+
hash
|
293
|
+
end
|
294
|
+
|
295
|
+
# Outputs non-array value in the form of hash
|
296
|
+
# For object, use to_hash. Otherwise, just return the value
|
297
|
+
# @param [Object] value Any valid value
|
298
|
+
# @return [Hash] Returns the value in the form of hash
|
299
|
+
def _to_hash(value)
|
300
|
+
if value.is_a?(Array)
|
301
|
+
value.compact.map{ |v| _to_hash(v) }
|
302
|
+
elsif value.is_a?(Hash)
|
303
|
+
{}.tap do |hash|
|
304
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
305
|
+
end
|
306
|
+
elsif value.respond_to? :to_hash
|
307
|
+
value.to_hash
|
308
|
+
else
|
309
|
+
value
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
end
|
314
|
+
|
315
|
+
end
|