talon_one 10.0.0 → 11.0.0
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/.github/workflows/autorelease.yml +123 -0
- data/README.md +55 -11
- data/docker-compose.yml +2 -2
- data/docs/AccountLimits.md +5 -1
- data/docs/Achievement.md +2 -0
- data/docs/AchievementBase.md +3 -1
- data/docs/AchievementProgressWithDefinition.md +3 -1
- data/docs/AchievementStatusEntry.md +2 -0
- data/docs/AddLoyaltyPoints.md +1 -1
- data/docs/AddedDeductedPointsNotification.md +41 -0
- data/docs/AnalyticsSKU.md +6 -2
- data/docs/ApplicationCustomer.md +1 -1
- data/docs/AsyncCouponsData.md +25 -0
- data/docs/AudienceCustomer.md +1 -1
- data/docs/AudienceReference.md +21 -0
- data/docs/BaseLoyaltyProgram.md +1 -1
- data/docs/BestPriorPrice.md +27 -0
- data/docs/BestPriorPriceMetadata.md +19 -0
- data/docs/BestPriorPriceRequest.md +25 -0
- data/docs/BestPriorPriceRequestTarget.md +19 -0
- data/docs/CampaignCollectionEditedNotification.md +6 -6
- data/docs/CampaignCollectionEditedNotificationItem.md +23 -0
- data/docs/CampaignCreatedNotification.md +6 -6
- data/docs/CampaignCreatedNotificationItem.md +23 -0
- data/docs/CampaignDeletedNotification.md +6 -4
- data/docs/CampaignDeletedNotificationItem.md +21 -0
- data/docs/CampaignEditedNotification.md +6 -6
- data/docs/CampaignEditedNotificationItem.md +23 -0
- data/docs/CampaignEvaluationTreeChangedMessage.md +21 -0
- data/docs/CampaignNotificationBase.md +19 -0
- data/docs/CampaignNotificationGeneric.md +21 -0
- data/docs/CampaignNotificationItemBase.md +17 -0
- data/docs/CampaignNotificationPolicy.md +1 -1
- data/docs/CampaignRulesetChangedNotification.md +6 -6
- data/docs/CampaignRulesetChangedNotificationItem.md +23 -0
- data/docs/CampaignStateChangedNotification.md +6 -8
- data/docs/CampaignStateChangedNotificationItem.md +25 -0
- data/docs/CardAddedDeductedPointsNotification.md +45 -0
- data/docs/CardExpiringPointsNotificationPolicy.md +1 -1
- data/docs/CardLedgerPointsEntryIntegrationAPI.md +2 -0
- data/docs/CardLedgerTransactionLogEntry.md +3 -1
- data/docs/CardLedgerTransactionLogEntryIntegrationAPI.md +3 -1
- data/docs/CatalogsStrikethroughNotificationPolicy.md +3 -1
- data/docs/CouponsNotificationData.md +27 -0
- data/docs/CouponsNotificationPolicy.md +1 -1
- data/docs/CreateAchievement.md +3 -1
- data/docs/CreateCouponData.md +29 -0
- data/docs/CustomerProfile.md +1 -1
- data/docs/DeleteCouponsData.md +31 -0
- data/docs/Effect.md +1 -1
- data/docs/ExpiringCardPointsData.md +29 -0
- data/docs/ExpiringCardPointsNotification.md +21 -0
- data/docs/ExpiringCouponsData.md +35 -0
- data/docs/ExpiringCouponsNotification.md +21 -0
- data/docs/ExpiringCouponsNotificationPolicy.md +1 -1
- data/docs/ExpiringPointsData.md +25 -0
- data/docs/ExpiringPointsNotification.md +21 -0
- data/docs/ExpiringPointsNotificationPolicy.md +1 -1
- data/docs/ExtendLoyaltyPointsExpiryDateEffectProps.md +2 -4
- data/docs/ExtendedCoupon.md +61 -0
- data/docs/GenerateAuditLogSummary.md +17 -0
- data/docs/GenerateCampaignDescription.md +3 -1
- data/docs/GenerateCouponFailureDetailedSummary.md +25 -0
- data/docs/GenerateCouponFailureSummary.md +19 -0
- data/docs/GenerateUserSessionSummary.md +19 -0
- data/docs/GetIntegrationCouponRequest.md +1 -1
- data/docs/InlineResponse20040.md +1 -1
- data/docs/InlineResponse20041.md +1 -1
- data/docs/InlineResponse20042.md +4 -2
- data/docs/InlineResponse20043.md +1 -1
- data/docs/InlineResponse20044.md +2 -4
- data/docs/InlineResponse20045.md +5 -3
- data/docs/InlineResponse20046.md +2 -4
- data/docs/InlineResponse20047.md +2 -6
- data/docs/InlineResponse20048.md +4 -2
- data/docs/InlineResponse20049.md +4 -2
- data/docs/IntegrationApi.md +88 -3
- data/docs/JWT.md +19 -0
- data/docs/LabelTargetAudience.md +19 -0
- data/docs/LabelTargetNone.md +17 -0
- data/docs/LedgerPointsEntryIntegrationAPI.md +2 -0
- data/docs/LedgerTransactionLogEntryIntegrationAPI.md +3 -1
- data/docs/LoyaltyDashboardData.md +2 -0
- data/docs/LoyaltyLedgerEntryExpiryDateChange.md +21 -0
- data/docs/LoyaltyProgram.md +1 -1
- data/docs/LoyaltyProgramTransaction.md +2 -0
- data/docs/ManagementApi.md +1083 -366
- data/docs/NewLoyaltyProgram.md +1 -1
- data/docs/NewMessageTest.md +6 -6
- data/docs/NewPriceAdjustment.md +3 -1
- data/docs/NewPriceType.md +4 -4
- data/docs/NewSecondaryDeployment.md +17 -0
- data/docs/NewWebhook.md +3 -1
- data/docs/PendingActivePointsData.md +29 -0
- data/docs/PendingActivePointsNotification.md +21 -0
- data/docs/PendingPointsNotificationPolicy.md +1 -1
- data/docs/PriceDetail.md +2 -0
- data/docs/PriceType.md +4 -4
- data/docs/PriceTypeReferenceDetail.md +23 -0
- data/docs/PriceTypeReferences.md +19 -0
- data/docs/RoleV2RolesGroup.md +3 -1
- data/docs/SecondaryDeployment.md +31 -0
- data/docs/SetLoyaltyPointsExpiryDateEffectProps.md +23 -0
- data/docs/StrikethroughChangedItem.md +2 -0
- data/docs/StrikethroughEffect.md +9 -1
- data/docs/StrikethroughLabelingNotification.md +3 -1
- data/docs/TierDowngradeData.md +31 -0
- data/docs/TierDowngradeNotification.md +21 -0
- data/docs/TierDowngradeNotificationPolicy.md +1 -1
- data/docs/TierUpgradeData.md +35 -0
- data/docs/TierUpgradeNotification.md +21 -0
- data/docs/TierUpgradeNotificationPolicy.md +1 -1
- data/docs/TierWillDowngradeData.md +31 -0
- data/docs/TierWillDowngradeNotification.md +21 -0
- data/docs/TierWillDowngradeNotificationPolicy.md +1 -1
- data/docs/UpdateAchievement.md +3 -1
- data/docs/UpdateCouponsData.md +29 -0
- data/docs/UpdateLoyaltyProgram.md +1 -1
- data/docs/UpdatePriceType.md +21 -0
- data/docs/Webhook.md +3 -1
- data/docs/WebhookWithOutgoingIntegrationDetails.md +2 -0
- data/lib/talon_one/api/integration_api.rb +104 -2
- data/lib/talon_one/api/management_api.rb +226 -400
- data/lib/talon_one/models/account_limits.rb +34 -4
- data/lib/talon_one/models/achievement.rb +11 -1
- data/lib/talon_one/models/achievement_base.rb +14 -4
- data/lib/talon_one/models/achievement_progress_with_definition.rb +14 -4
- data/lib/talon_one/models/achievement_status_entry.rb +11 -1
- data/lib/talon_one/models/add_loyalty_points.rb +1 -10
- data/lib/talon_one/models/added_deducted_points_notification.rb +478 -0
- data/lib/talon_one/models/analytics_sku.rb +23 -3
- data/lib/talon_one/models/application_customer.rb +1 -1
- data/lib/talon_one/models/async_coupons_data.rb +272 -0
- data/lib/talon_one/models/audience_customer.rb +1 -1
- data/lib/talon_one/models/audience_reference.rb +256 -0
- data/lib/talon_one/models/base_loyalty_program.rb +1 -1
- data/lib/talon_one/models/best_prior_price.rb +285 -0
- data/lib/talon_one/models/best_prior_price_metadata.rb +219 -0
- data/lib/talon_one/models/best_prior_price_request.rb +268 -0
- data/lib/talon_one/models/best_prior_price_request_target.rb +257 -0
- data/lib/talon_one/models/campaign_collection_edited_notification.rb +30 -26
- data/lib/talon_one/models/campaign_collection_edited_notification_item.rb +250 -0
- data/lib/talon_one/models/campaign_created_notification.rb +30 -26
- data/lib/talon_one/models/campaign_created_notification_item.rb +250 -0
- data/lib/talon_one/models/campaign_deleted_notification.rb +33 -21
- data/lib/talon_one/models/campaign_deleted_notification_item.rb +242 -0
- data/lib/talon_one/models/campaign_edited_notification.rb +30 -26
- data/lib/talon_one/models/campaign_edited_notification_item.rb +250 -0
- data/lib/talon_one/models/campaign_evaluation_tree_changed_message.rb +239 -0
- data/lib/talon_one/models/campaign_notification_base.rb +227 -0
- data/lib/talon_one/models/campaign_notification_generic.rb +244 -0
- data/lib/talon_one/models/campaign_notification_item_base.rb +212 -0
- data/lib/talon_one/models/campaign_notification_policy.rb +2 -0
- data/lib/talon_one/models/campaign_ruleset_changed_notification.rb +32 -23
- data/lib/talon_one/models/campaign_ruleset_changed_notification_item.rb +245 -0
- data/lib/talon_one/models/campaign_state_changed_notification.rb +30 -42
- data/lib/talon_one/models/campaign_state_changed_notification_item.rb +266 -0
- data/lib/talon_one/models/card_added_deducted_points_notification.rb +510 -0
- data/lib/talon_one/models/card_expiring_points_notification_policy.rb +2 -0
- data/lib/talon_one/models/card_ledger_points_entry_integration_api.rb +16 -1
- data/lib/talon_one/models/card_ledger_transaction_log_entry.rb +16 -1
- data/lib/talon_one/models/card_ledger_transaction_log_entry_integration_api.rb +16 -1
- data/lib/talon_one/models/catalogs_strikethrough_notification_policy.rb +16 -4
- data/lib/talon_one/models/coupons_notification_data.rb +278 -0
- data/lib/talon_one/models/coupons_notification_policy.rb +2 -0
- data/lib/talon_one/models/create_achievement.rb +14 -4
- data/lib/talon_one/models/create_coupon_data.rb +288 -0
- data/lib/talon_one/models/customer_profile.rb +1 -1
- data/lib/talon_one/models/deduct_loyalty_points.rb +0 -9
- data/lib/talon_one/models/delete_coupons_data.rb +310 -0
- data/lib/talon_one/models/effect.rb +0 -1
- data/lib/talon_one/models/expiring_card_points_data.rb +342 -0
- data/lib/talon_one/models/expiring_card_points_notification.rb +277 -0
- data/lib/talon_one/models/expiring_coupons_data.rb +369 -0
- data/lib/talon_one/models/expiring_coupons_notification.rb +277 -0
- data/lib/talon_one/models/expiring_coupons_notification_policy.rb +2 -0
- data/lib/talon_one/models/expiring_points_data.rb +291 -0
- data/lib/talon_one/models/expiring_points_notification.rb +277 -0
- data/lib/talon_one/models/expiring_points_notification_policy.rb +2 -0
- data/lib/talon_one/models/extend_loyalty_points_expiry_date_effect_props.rb +9 -24
- data/lib/talon_one/models/extended_coupon.rb +578 -0
- data/lib/talon_one/models/generate_audit_log_summary.rb +212 -0
- data/lib/talon_one/models/generate_campaign_description.rb +16 -1
- data/lib/talon_one/models/generate_coupon_failure_detailed_summary.rb +286 -0
- data/lib/talon_one/models/generate_coupon_failure_summary.rb +222 -0
- data/lib/talon_one/models/generate_user_session_summary.rb +227 -0
- data/lib/talon_one/models/get_integration_coupon_request.rb +2 -0
- data/lib/talon_one/models/inline_response20040.rb +1 -1
- data/lib/talon_one/models/inline_response20041.rb +1 -1
- data/lib/talon_one/models/inline_response20042.rb +11 -7
- data/lib/talon_one/models/inline_response20043.rb +1 -1
- data/lib/talon_one/models/inline_response20044.rb +7 -11
- data/lib/talon_one/models/inline_response20045.rb +11 -7
- data/lib/talon_one/models/inline_response20046.rb +2 -21
- data/lib/talon_one/models/inline_response20047.rb +2 -25
- data/lib/talon_one/models/inline_response20048.rb +16 -2
- data/lib/talon_one/models/inline_response20049.rb +21 -2
- data/lib/talon_one/models/jwt.rb +228 -0
- data/lib/talon_one/models/label_target_audience.rb +260 -0
- data/lib/talon_one/models/label_target_none.rb +246 -0
- data/lib/talon_one/models/ledger_points_entry_integration_api.rb +16 -1
- data/lib/talon_one/models/ledger_transaction_log_entry_integration_api.rb +17 -2
- data/lib/talon_one/models/loyalty_dashboard_data.rb +16 -1
- data/lib/talon_one/models/loyalty_ledger_entry_expiry_date_change.rb +238 -0
- data/lib/talon_one/models/loyalty_program.rb +1 -1
- data/lib/talon_one/models/loyalty_program_transaction.rb +16 -1
- data/lib/talon_one/models/new_loyalty_program.rb +1 -1
- data/lib/talon_one/models/new_message_test.rb +28 -43
- data/lib/talon_one/models/new_price_adjustment.rb +33 -4
- data/lib/talon_one/models/new_price_type.rb +3 -3
- data/lib/talon_one/models/new_secondary_deployment.rb +242 -0
- data/lib/talon_one/models/new_webhook.rb +14 -4
- data/lib/talon_one/models/pending_active_points_data.rb +308 -0
- data/lib/talon_one/models/pending_active_points_notification.rb +277 -0
- data/lib/talon_one/models/pending_points_notification_policy.rb +2 -0
- data/lib/talon_one/models/price_detail.rb +11 -1
- data/lib/talon_one/models/price_type.rb +3 -3
- data/lib/talon_one/models/price_type_reference_detail.rb +286 -0
- data/lib/talon_one/models/price_type_references.rb +224 -0
- data/lib/talon_one/models/role_v2_roles_group.rb +14 -4
- data/lib/talon_one/models/secondary_deployment.rb +367 -0
- data/lib/talon_one/models/set_loyalty_points_expiry_date_effect_props.rb +255 -0
- data/lib/talon_one/models/strikethrough_changed_item.rb +13 -1
- data/lib/talon_one/models/strikethrough_effect.rb +46 -4
- data/lib/talon_one/models/strikethrough_labeling_notification.rb +19 -4
- data/lib/talon_one/models/tier_downgrade_data.rb +328 -0
- data/lib/talon_one/models/tier_downgrade_notification.rb +277 -0
- data/lib/talon_one/models/tier_downgrade_notification_policy.rb +2 -0
- data/lib/talon_one/models/tier_upgrade_data.rb +353 -0
- data/lib/talon_one/models/tier_upgrade_notification.rb +277 -0
- data/lib/talon_one/models/tier_upgrade_notification_policy.rb +2 -0
- data/lib/talon_one/models/tier_will_downgrade_data.rb +328 -0
- data/lib/talon_one/models/tier_will_downgrade_notification.rb +277 -0
- data/lib/talon_one/models/tier_will_downgrade_notification_policy.rb +2 -0
- data/lib/talon_one/models/update_achievement.rb +14 -4
- data/lib/talon_one/models/update_coupons_data.rb +296 -0
- data/lib/talon_one/models/update_loyalty_program.rb +1 -1
- data/lib/talon_one/models/update_price_type.rb +239 -0
- data/lib/talon_one/models/webhook.rb +14 -4
- data/lib/talon_one/models/webhook_with_outgoing_integration_details.rb +11 -1
- data/lib/talon_one/version.rb +1 -1
- data/lib/talon_one.rb +51 -6
- data/spec/api/integration_api_spec.rb +23 -1
- data/spec/api/management_api_spec.rb +18 -54
- data/spec/models/account_limits_spec.rb +12 -0
- data/spec/models/achievement_base_spec.rb +6 -0
- data/spec/models/achievement_progress_with_definition_spec.rb +6 -0
- data/spec/models/achievement_spec.rb +6 -0
- data/spec/models/achievement_status_entry_spec.rb +6 -0
- data/spec/models/added_deducted_points_notification_spec.rb +125 -0
- data/spec/models/analytics_sku_spec.rb +12 -0
- data/spec/models/async_coupons_data_spec.rb +65 -0
- data/spec/models/audience_reference_spec.rb +53 -0
- data/spec/models/best_prior_price_metadata_spec.rb +47 -0
- data/spec/models/best_prior_price_request_spec.rb +65 -0
- data/spec/models/best_prior_price_request_target_spec.rb +51 -0
- data/spec/models/best_prior_price_spec.rb +71 -0
- data/spec/models/campaign_collection_edited_notification_item_spec.rb +59 -0
- data/spec/models/campaign_collection_edited_notification_spec.rb +3 -3
- data/spec/models/campaign_created_notification_item_spec.rb +59 -0
- data/spec/models/campaign_created_notification_spec.rb +3 -3
- data/spec/models/campaign_deleted_notification_item_spec.rb +53 -0
- data/spec/models/campaign_deleted_notification_spec.rb +8 -2
- data/spec/models/campaign_edited_notification_item_spec.rb +59 -0
- data/spec/models/campaign_edited_notification_spec.rb +3 -3
- data/spec/models/campaign_evaluation_tree_changed_message_spec.rb +53 -0
- data/spec/models/campaign_notification_base_spec.rb +47 -0
- data/spec/models/campaign_notification_generic_spec.rb +53 -0
- data/spec/models/campaign_notification_item_base_spec.rb +41 -0
- data/spec/models/campaign_ruleset_changed_notification_item_spec.rb +59 -0
- data/spec/models/campaign_ruleset_changed_notification_spec.rb +3 -3
- data/spec/models/campaign_state_changed_notification_item_spec.rb +65 -0
- data/spec/models/campaign_state_changed_notification_spec.rb +3 -9
- data/spec/models/card_added_deducted_points_notification_spec.rb +137 -0
- data/spec/models/card_ledger_points_entry_integration_api_spec.rb +6 -0
- data/spec/models/card_ledger_transaction_log_entry_integration_api_spec.rb +6 -0
- data/spec/models/card_ledger_transaction_log_entry_spec.rb +6 -0
- data/spec/models/catalogs_strikethrough_notification_policy_spec.rb +6 -0
- data/spec/models/coupons_notification_data_spec.rb +71 -0
- data/spec/models/create_achievement_spec.rb +6 -0
- data/spec/models/create_coupon_data_spec.rb +77 -0
- data/spec/models/delete_coupons_data_spec.rb +83 -0
- data/spec/models/expiring_card_points_data_spec.rb +77 -0
- data/spec/models/expiring_card_points_notification_spec.rb +57 -0
- data/spec/models/expiring_coupons_data_spec.rb +95 -0
- data/spec/models/expiring_coupons_notification_spec.rb +57 -0
- data/spec/models/expiring_points_data_spec.rb +65 -0
- data/spec/models/expiring_points_notification_spec.rb +57 -0
- data/spec/models/extend_loyalty_points_expiry_date_effect_props_spec.rb +1 -7
- data/spec/models/extended_coupon_spec.rb +173 -0
- data/spec/models/generate_audit_log_summary_spec.rb +41 -0
- data/spec/models/generate_campaign_description_spec.rb +6 -0
- data/spec/models/generate_coupon_failure_detailed_summary_spec.rb +65 -0
- data/spec/models/generate_coupon_failure_summary_spec.rb +47 -0
- data/spec/models/generate_user_session_summary_spec.rb +47 -0
- data/spec/models/inline_response20042_spec.rb +6 -0
- data/spec/models/inline_response20044_spec.rb +0 -6
- data/spec/models/inline_response20045_spec.rb +6 -0
- data/spec/models/inline_response20046_spec.rb +0 -6
- data/spec/models/inline_response20047_spec.rb +0 -12
- data/spec/models/inline_response20048_spec.rb +6 -0
- data/spec/models/inline_response20049_spec.rb +6 -0
- data/spec/models/jwt_spec.rb +47 -0
- data/spec/models/label_target_audience_spec.rb +51 -0
- data/spec/models/label_target_none_spec.rb +45 -0
- data/spec/models/ledger_points_entry_integration_api_spec.rb +6 -0
- data/spec/models/ledger_transaction_log_entry_integration_api_spec.rb +6 -0
- data/spec/models/loyalty_dashboard_data_spec.rb +6 -0
- data/spec/models/loyalty_ledger_entry_expiry_date_change_spec.rb +53 -0
- data/spec/models/loyalty_program_transaction_spec.rb +6 -0
- data/spec/models/new_message_test_spec.rb +10 -14
- data/spec/models/new_price_adjustment_spec.rb +6 -0
- data/spec/models/new_secondary_deployment_spec.rb +41 -0
- data/spec/models/new_webhook_spec.rb +6 -0
- data/spec/models/pending_active_points_data_spec.rb +77 -0
- data/spec/models/pending_active_points_notification_spec.rb +57 -0
- data/spec/models/price_detail_spec.rb +6 -0
- data/spec/models/price_type_reference_detail_spec.rb +63 -0
- data/spec/models/price_type_references_spec.rb +47 -0
- data/spec/models/role_v2_roles_group_spec.rb +6 -0
- data/spec/models/secondary_deployment_spec.rb +87 -0
- data/spec/models/set_loyalty_points_expiry_date_effect_props_spec.rb +59 -0
- data/spec/models/strikethrough_changed_item_spec.rb +6 -0
- data/spec/models/strikethrough_effect_spec.rb +24 -0
- data/spec/models/strikethrough_labeling_notification_spec.rb +6 -0
- data/spec/models/tier_downgrade_data_spec.rb +83 -0
- data/spec/models/tier_downgrade_notification_spec.rb +57 -0
- data/spec/models/tier_upgrade_data_spec.rb +95 -0
- data/spec/models/tier_upgrade_notification_spec.rb +57 -0
- data/spec/models/tier_will_downgrade_data_spec.rb +83 -0
- data/spec/models/tier_will_downgrade_notification_spec.rb +57 -0
- data/spec/models/update_achievement_spec.rb +6 -0
- data/spec/models/update_coupons_data_spec.rb +77 -0
- data/spec/models/update_price_type_spec.rb +53 -0
- data/spec/models/webhook_spec.rb +6 -0
- data/spec/models/webhook_with_outgoing_integration_details_spec.rb +6 -0
- metadata +206 -2
- data/.github/dependabot.yml +0 -10
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Talon.One API
|
|
3
|
+
|
|
4
|
+
#Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) are used to integrate with our platform - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document:
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 4.3.1
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module TalonOne
|
|
16
|
+
class ExtendedCoupon
|
|
17
|
+
# The internal ID of the coupon.
|
|
18
|
+
attr_accessor :id
|
|
19
|
+
|
|
20
|
+
# The time the coupon was created.
|
|
21
|
+
attr_accessor :created
|
|
22
|
+
|
|
23
|
+
# The ID of the campaign that owns this entity.
|
|
24
|
+
attr_accessor :campaign_id
|
|
25
|
+
|
|
26
|
+
# The coupon code.
|
|
27
|
+
attr_accessor :value
|
|
28
|
+
|
|
29
|
+
# The number of times the coupon code can be redeemed. `0` means unlimited redemptions but any campaign usage limits will still apply.
|
|
30
|
+
attr_accessor :usage_limit
|
|
31
|
+
|
|
32
|
+
# The total discount value that the code can give. Typically used to represent a gift card value.
|
|
33
|
+
attr_accessor :discount_limit
|
|
34
|
+
|
|
35
|
+
# The number of reservations that can be made with this coupon code.
|
|
36
|
+
attr_accessor :reservation_limit
|
|
37
|
+
|
|
38
|
+
# Timestamp at which point the coupon becomes valid.
|
|
39
|
+
attr_accessor :start_date
|
|
40
|
+
|
|
41
|
+
# Expiration date of the coupon. Coupon never expires if this is omitted.
|
|
42
|
+
attr_accessor :expiry_date
|
|
43
|
+
|
|
44
|
+
# Limits configuration for a coupon. These limits will override the limits set from the campaign. **Note:** Only usable when creating a single coupon which is not tied to a specific recipient. Only per-profile limits are allowed to be configured.
|
|
45
|
+
attr_accessor :limits
|
|
46
|
+
|
|
47
|
+
# The number of times the coupon has been successfully redeemed.
|
|
48
|
+
attr_accessor :usage_counter
|
|
49
|
+
|
|
50
|
+
# The amount of discounts given on rules redeeming this coupon. Only usable if a coupon discount budget was set for this coupon.
|
|
51
|
+
attr_accessor :discount_counter
|
|
52
|
+
|
|
53
|
+
# The remaining discount this coupon can give.
|
|
54
|
+
attr_accessor :discount_remainder
|
|
55
|
+
|
|
56
|
+
# The number of times this coupon has been reserved.
|
|
57
|
+
attr_accessor :reservation_counter
|
|
58
|
+
|
|
59
|
+
# Custom attributes associated with this coupon.
|
|
60
|
+
attr_accessor :attributes
|
|
61
|
+
|
|
62
|
+
# The integration ID of the referring customer (if any) for whom this coupon was created as an effect.
|
|
63
|
+
attr_accessor :referral_id
|
|
64
|
+
|
|
65
|
+
# The Integration ID of the customer that is allowed to redeem this coupon.
|
|
66
|
+
attr_accessor :recipient_integration_id
|
|
67
|
+
|
|
68
|
+
# The ID of the Import which created this coupon.
|
|
69
|
+
attr_accessor :import_id
|
|
70
|
+
|
|
71
|
+
# Defines the reservation type: - `true`: The coupon can be reserved for multiple customers. - `false`: The coupon can be reserved only for one customer. It is a personal code.
|
|
72
|
+
attr_accessor :reservation
|
|
73
|
+
|
|
74
|
+
# The id of the batch the coupon belongs to.
|
|
75
|
+
attr_accessor :batch_id
|
|
76
|
+
|
|
77
|
+
# An indication of whether the code can be redeemed only if it has been reserved first.
|
|
78
|
+
attr_accessor :is_reservation_mandatory
|
|
79
|
+
|
|
80
|
+
# An indication of whether the coupon is implicitly reserved for all customers.
|
|
81
|
+
attr_accessor :implicitly_reserved
|
|
82
|
+
|
|
83
|
+
# The ID of the application.
|
|
84
|
+
attr_accessor :application_id
|
|
85
|
+
|
|
86
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
87
|
+
def self.attribute_map
|
|
88
|
+
{
|
|
89
|
+
:'id' => :'id',
|
|
90
|
+
:'created' => :'created',
|
|
91
|
+
:'campaign_id' => :'campaignId',
|
|
92
|
+
:'value' => :'value',
|
|
93
|
+
:'usage_limit' => :'usageLimit',
|
|
94
|
+
:'discount_limit' => :'discountLimit',
|
|
95
|
+
:'reservation_limit' => :'reservationLimit',
|
|
96
|
+
:'start_date' => :'startDate',
|
|
97
|
+
:'expiry_date' => :'expiryDate',
|
|
98
|
+
:'limits' => :'limits',
|
|
99
|
+
:'usage_counter' => :'usageCounter',
|
|
100
|
+
:'discount_counter' => :'discountCounter',
|
|
101
|
+
:'discount_remainder' => :'discountRemainder',
|
|
102
|
+
:'reservation_counter' => :'reservationCounter',
|
|
103
|
+
:'attributes' => :'attributes',
|
|
104
|
+
:'referral_id' => :'referralId',
|
|
105
|
+
:'recipient_integration_id' => :'recipientIntegrationId',
|
|
106
|
+
:'import_id' => :'importId',
|
|
107
|
+
:'reservation' => :'reservation',
|
|
108
|
+
:'batch_id' => :'batchId',
|
|
109
|
+
:'is_reservation_mandatory' => :'isReservationMandatory',
|
|
110
|
+
:'implicitly_reserved' => :'implicitlyReserved',
|
|
111
|
+
:'application_id' => :'ApplicationId'
|
|
112
|
+
}
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Attribute type mapping.
|
|
116
|
+
def self.openapi_types
|
|
117
|
+
{
|
|
118
|
+
:'id' => :'Integer',
|
|
119
|
+
:'created' => :'DateTime',
|
|
120
|
+
:'campaign_id' => :'Integer',
|
|
121
|
+
:'value' => :'String',
|
|
122
|
+
:'usage_limit' => :'Integer',
|
|
123
|
+
:'discount_limit' => :'Float',
|
|
124
|
+
:'reservation_limit' => :'Integer',
|
|
125
|
+
:'start_date' => :'DateTime',
|
|
126
|
+
:'expiry_date' => :'DateTime',
|
|
127
|
+
:'limits' => :'Array<LimitConfig>',
|
|
128
|
+
:'usage_counter' => :'Integer',
|
|
129
|
+
:'discount_counter' => :'Float',
|
|
130
|
+
:'discount_remainder' => :'Float',
|
|
131
|
+
:'reservation_counter' => :'Float',
|
|
132
|
+
:'attributes' => :'Object',
|
|
133
|
+
:'referral_id' => :'Integer',
|
|
134
|
+
:'recipient_integration_id' => :'String',
|
|
135
|
+
:'import_id' => :'Integer',
|
|
136
|
+
:'reservation' => :'Boolean',
|
|
137
|
+
:'batch_id' => :'String',
|
|
138
|
+
:'is_reservation_mandatory' => :'Boolean',
|
|
139
|
+
:'implicitly_reserved' => :'Boolean',
|
|
140
|
+
:'application_id' => :'Integer'
|
|
141
|
+
}
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# List of attributes with nullable: true
|
|
145
|
+
def self.openapi_nullable
|
|
146
|
+
Set.new([
|
|
147
|
+
])
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Initializes the object
|
|
151
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
152
|
+
def initialize(attributes = {})
|
|
153
|
+
if (!attributes.is_a?(Hash))
|
|
154
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::ExtendedCoupon` initialize method"
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
158
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
159
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
160
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TalonOne::ExtendedCoupon`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
161
|
+
end
|
|
162
|
+
h[k.to_sym] = v
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'id')
|
|
166
|
+
self.id = attributes[:'id']
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'created')
|
|
170
|
+
self.created = attributes[:'created']
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if attributes.key?(:'campaign_id')
|
|
174
|
+
self.campaign_id = attributes[:'campaign_id']
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
if attributes.key?(:'value')
|
|
178
|
+
self.value = attributes[:'value']
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
if attributes.key?(:'usage_limit')
|
|
182
|
+
self.usage_limit = attributes[:'usage_limit']
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
if attributes.key?(:'discount_limit')
|
|
186
|
+
self.discount_limit = attributes[:'discount_limit']
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
if attributes.key?(:'reservation_limit')
|
|
190
|
+
self.reservation_limit = attributes[:'reservation_limit']
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
if attributes.key?(:'start_date')
|
|
194
|
+
self.start_date = attributes[:'start_date']
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if attributes.key?(:'expiry_date')
|
|
198
|
+
self.expiry_date = attributes[:'expiry_date']
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
if attributes.key?(:'limits')
|
|
202
|
+
if (value = attributes[:'limits']).is_a?(Array)
|
|
203
|
+
self.limits = value
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
if attributes.key?(:'usage_counter')
|
|
208
|
+
self.usage_counter = attributes[:'usage_counter']
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
if attributes.key?(:'discount_counter')
|
|
212
|
+
self.discount_counter = attributes[:'discount_counter']
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
if attributes.key?(:'discount_remainder')
|
|
216
|
+
self.discount_remainder = attributes[:'discount_remainder']
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
if attributes.key?(:'reservation_counter')
|
|
220
|
+
self.reservation_counter = attributes[:'reservation_counter']
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
if attributes.key?(:'attributes')
|
|
224
|
+
self.attributes = attributes[:'attributes']
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if attributes.key?(:'referral_id')
|
|
228
|
+
self.referral_id = attributes[:'referral_id']
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
if attributes.key?(:'recipient_integration_id')
|
|
232
|
+
self.recipient_integration_id = attributes[:'recipient_integration_id']
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
if attributes.key?(:'import_id')
|
|
236
|
+
self.import_id = attributes[:'import_id']
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
if attributes.key?(:'reservation')
|
|
240
|
+
self.reservation = attributes[:'reservation']
|
|
241
|
+
else
|
|
242
|
+
self.reservation = true
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
if attributes.key?(:'batch_id')
|
|
246
|
+
self.batch_id = attributes[:'batch_id']
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
if attributes.key?(:'is_reservation_mandatory')
|
|
250
|
+
self.is_reservation_mandatory = attributes[:'is_reservation_mandatory']
|
|
251
|
+
else
|
|
252
|
+
self.is_reservation_mandatory = false
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
if attributes.key?(:'implicitly_reserved')
|
|
256
|
+
self.implicitly_reserved = attributes[:'implicitly_reserved']
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
if attributes.key?(:'application_id')
|
|
260
|
+
self.application_id = attributes[:'application_id']
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
265
|
+
# @return Array for valid properties with the reasons
|
|
266
|
+
def list_invalid_properties
|
|
267
|
+
invalid_properties = Array.new
|
|
268
|
+
if @id.nil?
|
|
269
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
if @created.nil?
|
|
273
|
+
invalid_properties.push('invalid value for "created", created cannot be nil.')
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
if @campaign_id.nil?
|
|
277
|
+
invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
if @value.nil?
|
|
281
|
+
invalid_properties.push('invalid value for "value", value cannot be nil.')
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
if @value.to_s.length < 4
|
|
285
|
+
invalid_properties.push('invalid value for "value", the character length must be great than or equal to 4.')
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
if @usage_limit.nil?
|
|
289
|
+
invalid_properties.push('invalid value for "usage_limit", usage_limit cannot be nil.')
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
if @usage_limit > 999999
|
|
293
|
+
invalid_properties.push('invalid value for "usage_limit", must be smaller than or equal to 999999.')
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
if @usage_limit < 0
|
|
297
|
+
invalid_properties.push('invalid value for "usage_limit", must be greater than or equal to 0.')
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
if !@discount_limit.nil? && @discount_limit > 1E+15
|
|
301
|
+
invalid_properties.push('invalid value for "discount_limit", must be smaller than or equal to 1E+15.')
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
if !@discount_limit.nil? && @discount_limit < 0
|
|
305
|
+
invalid_properties.push('invalid value for "discount_limit", must be greater than or equal to 0.')
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
if !@reservation_limit.nil? && @reservation_limit > 999999
|
|
309
|
+
invalid_properties.push('invalid value for "reservation_limit", must be smaller than or equal to 999999.')
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
if !@reservation_limit.nil? && @reservation_limit < 0
|
|
313
|
+
invalid_properties.push('invalid value for "reservation_limit", must be greater than or equal to 0.')
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
if @usage_counter.nil?
|
|
317
|
+
invalid_properties.push('invalid value for "usage_counter", usage_counter cannot be nil.')
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
if !@recipient_integration_id.nil? && @recipient_integration_id.to_s.length > 1000
|
|
321
|
+
invalid_properties.push('invalid value for "recipient_integration_id", the character length must be smaller than or equal to 1000.')
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
if @application_id.nil?
|
|
325
|
+
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
invalid_properties
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# Check to see if the all the properties in the model are valid
|
|
332
|
+
# @return true if the model is valid
|
|
333
|
+
def valid?
|
|
334
|
+
return false if @id.nil?
|
|
335
|
+
return false if @created.nil?
|
|
336
|
+
return false if @campaign_id.nil?
|
|
337
|
+
return false if @value.nil?
|
|
338
|
+
return false if @value.to_s.length < 4
|
|
339
|
+
return false if @usage_limit.nil?
|
|
340
|
+
return false if @usage_limit > 999999
|
|
341
|
+
return false if @usage_limit < 0
|
|
342
|
+
return false if !@discount_limit.nil? && @discount_limit > 1E+15
|
|
343
|
+
return false if !@discount_limit.nil? && @discount_limit < 0
|
|
344
|
+
return false if !@reservation_limit.nil? && @reservation_limit > 999999
|
|
345
|
+
return false if !@reservation_limit.nil? && @reservation_limit < 0
|
|
346
|
+
return false if @usage_counter.nil?
|
|
347
|
+
return false if !@recipient_integration_id.nil? && @recipient_integration_id.to_s.length > 1000
|
|
348
|
+
return false if @application_id.nil?
|
|
349
|
+
true
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
# Custom attribute writer method with validation
|
|
353
|
+
# @param [Object] value Value to be assigned
|
|
354
|
+
def value=(value)
|
|
355
|
+
if value.nil?
|
|
356
|
+
fail ArgumentError, 'value cannot be nil'
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
if value.to_s.length < 4
|
|
360
|
+
fail ArgumentError, 'invalid value for "value", the character length must be great than or equal to 4.'
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
@value = value
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
# Custom attribute writer method with validation
|
|
367
|
+
# @param [Object] usage_limit Value to be assigned
|
|
368
|
+
def usage_limit=(usage_limit)
|
|
369
|
+
if usage_limit.nil?
|
|
370
|
+
fail ArgumentError, 'usage_limit cannot be nil'
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
if usage_limit > 999999
|
|
374
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be smaller than or equal to 999999.'
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
if usage_limit < 0
|
|
378
|
+
fail ArgumentError, 'invalid value for "usage_limit", must be greater than or equal to 0.'
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
@usage_limit = usage_limit
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
# Custom attribute writer method with validation
|
|
385
|
+
# @param [Object] discount_limit Value to be assigned
|
|
386
|
+
def discount_limit=(discount_limit)
|
|
387
|
+
if !discount_limit.nil? && discount_limit > 1E+15
|
|
388
|
+
fail ArgumentError, 'invalid value for "discount_limit", must be smaller than or equal to 1E+15.'
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
if !discount_limit.nil? && discount_limit < 0
|
|
392
|
+
fail ArgumentError, 'invalid value for "discount_limit", must be greater than or equal to 0.'
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
@discount_limit = discount_limit
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
# Custom attribute writer method with validation
|
|
399
|
+
# @param [Object] reservation_limit Value to be assigned
|
|
400
|
+
def reservation_limit=(reservation_limit)
|
|
401
|
+
if !reservation_limit.nil? && reservation_limit > 999999
|
|
402
|
+
fail ArgumentError, 'invalid value for "reservation_limit", must be smaller than or equal to 999999.'
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
if !reservation_limit.nil? && reservation_limit < 0
|
|
406
|
+
fail ArgumentError, 'invalid value for "reservation_limit", must be greater than or equal to 0.'
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
@reservation_limit = reservation_limit
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# Custom attribute writer method with validation
|
|
413
|
+
# @param [Object] recipient_integration_id Value to be assigned
|
|
414
|
+
def recipient_integration_id=(recipient_integration_id)
|
|
415
|
+
if !recipient_integration_id.nil? && recipient_integration_id.to_s.length > 1000
|
|
416
|
+
fail ArgumentError, 'invalid value for "recipient_integration_id", the character length must be smaller than or equal to 1000.'
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
@recipient_integration_id = recipient_integration_id
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
# Checks equality by comparing each attribute.
|
|
423
|
+
# @param [Object] Object to be compared
|
|
424
|
+
def ==(o)
|
|
425
|
+
return true if self.equal?(o)
|
|
426
|
+
self.class == o.class &&
|
|
427
|
+
id == o.id &&
|
|
428
|
+
created == o.created &&
|
|
429
|
+
campaign_id == o.campaign_id &&
|
|
430
|
+
value == o.value &&
|
|
431
|
+
usage_limit == o.usage_limit &&
|
|
432
|
+
discount_limit == o.discount_limit &&
|
|
433
|
+
reservation_limit == o.reservation_limit &&
|
|
434
|
+
start_date == o.start_date &&
|
|
435
|
+
expiry_date == o.expiry_date &&
|
|
436
|
+
limits == o.limits &&
|
|
437
|
+
usage_counter == o.usage_counter &&
|
|
438
|
+
discount_counter == o.discount_counter &&
|
|
439
|
+
discount_remainder == o.discount_remainder &&
|
|
440
|
+
reservation_counter == o.reservation_counter &&
|
|
441
|
+
attributes == o.attributes &&
|
|
442
|
+
referral_id == o.referral_id &&
|
|
443
|
+
recipient_integration_id == o.recipient_integration_id &&
|
|
444
|
+
import_id == o.import_id &&
|
|
445
|
+
reservation == o.reservation &&
|
|
446
|
+
batch_id == o.batch_id &&
|
|
447
|
+
is_reservation_mandatory == o.is_reservation_mandatory &&
|
|
448
|
+
implicitly_reserved == o.implicitly_reserved &&
|
|
449
|
+
application_id == o.application_id
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
# @see the `==` method
|
|
453
|
+
# @param [Object] Object to be compared
|
|
454
|
+
def eql?(o)
|
|
455
|
+
self == o
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
# Calculates hash code according to all attributes.
|
|
459
|
+
# @return [Integer] Hash code
|
|
460
|
+
def hash
|
|
461
|
+
[id, created, campaign_id, value, usage_limit, discount_limit, reservation_limit, start_date, expiry_date, limits, usage_counter, discount_counter, discount_remainder, reservation_counter, attributes, referral_id, recipient_integration_id, import_id, reservation, batch_id, is_reservation_mandatory, implicitly_reserved, application_id].hash
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
# Builds the object from hash
|
|
465
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
466
|
+
# @return [Object] Returns the model itself
|
|
467
|
+
def self.build_from_hash(attributes)
|
|
468
|
+
new.build_from_hash(attributes)
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
# Builds the object from hash
|
|
472
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
473
|
+
# @return [Object] Returns the model itself
|
|
474
|
+
def build_from_hash(attributes)
|
|
475
|
+
return nil unless attributes.is_a?(Hash)
|
|
476
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
477
|
+
if type =~ /\AArray<(.*)>/i
|
|
478
|
+
# check to ensure the input is an array given that the attribute
|
|
479
|
+
# is documented as an array but the input is not
|
|
480
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
481
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
482
|
+
end
|
|
483
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
484
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
485
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
self
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
# Deserializes the data based on type
|
|
492
|
+
# @param string type Data type
|
|
493
|
+
# @param string value Value to be deserialized
|
|
494
|
+
# @return [Object] Deserialized data
|
|
495
|
+
def _deserialize(type, value)
|
|
496
|
+
case type.to_sym
|
|
497
|
+
when :DateTime
|
|
498
|
+
DateTime.parse(value)
|
|
499
|
+
when :Date
|
|
500
|
+
Date.parse(value)
|
|
501
|
+
when :String
|
|
502
|
+
value.to_s
|
|
503
|
+
when :Integer
|
|
504
|
+
value.to_i
|
|
505
|
+
when :Float
|
|
506
|
+
value.to_f
|
|
507
|
+
when :Boolean
|
|
508
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
509
|
+
true
|
|
510
|
+
else
|
|
511
|
+
false
|
|
512
|
+
end
|
|
513
|
+
when :Object
|
|
514
|
+
# generic object (usually a Hash), return directly
|
|
515
|
+
value
|
|
516
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
517
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
518
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
519
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
520
|
+
k_type = Regexp.last_match[:k_type]
|
|
521
|
+
v_type = Regexp.last_match[:v_type]
|
|
522
|
+
{}.tap do |hash|
|
|
523
|
+
value.each do |k, v|
|
|
524
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
525
|
+
end
|
|
526
|
+
end
|
|
527
|
+
else # model
|
|
528
|
+
TalonOne.const_get(type).build_from_hash(value)
|
|
529
|
+
end
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
# Returns the string representation of the object
|
|
533
|
+
# @return [String] String presentation of the object
|
|
534
|
+
def to_s
|
|
535
|
+
to_hash.to_s
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
539
|
+
# @return [Hash] Returns the object in the form of hash
|
|
540
|
+
def to_body
|
|
541
|
+
to_hash
|
|
542
|
+
end
|
|
543
|
+
|
|
544
|
+
# Returns the object in the form of hash
|
|
545
|
+
# @return [Hash] Returns the object in the form of hash
|
|
546
|
+
def to_hash
|
|
547
|
+
hash = {}
|
|
548
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
549
|
+
value = self.send(attr)
|
|
550
|
+
if value.nil?
|
|
551
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
552
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
hash[param] = _to_hash(value)
|
|
556
|
+
end
|
|
557
|
+
hash
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
# Outputs non-array value in the form of hash
|
|
561
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
562
|
+
# @param [Object] value Any valid value
|
|
563
|
+
# @return [Hash] Returns the value in the form of hash
|
|
564
|
+
def _to_hash(value)
|
|
565
|
+
if value.is_a?(Array)
|
|
566
|
+
value.compact.map { |v| _to_hash(v) }
|
|
567
|
+
elsif value.is_a?(Hash)
|
|
568
|
+
{}.tap do |hash|
|
|
569
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
570
|
+
end
|
|
571
|
+
elsif value.respond_to? :to_hash
|
|
572
|
+
value.to_hash
|
|
573
|
+
else
|
|
574
|
+
value
|
|
575
|
+
end
|
|
576
|
+
end
|
|
577
|
+
end
|
|
578
|
+
end
|