talon_one 0.0.10 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/Gemfile +4 -0
- data/README.md +398 -55
- data/Rakefile +6 -8
- data/docs/APIError.md +10 -0
- data/docs/AccessLogEntry.md +14 -0
- data/docs/Account.md +25 -0
- data/docs/AccountAnalytics.md +21 -0
- data/docs/AccountEntity.md +8 -0
- data/docs/AccountLimits.md +18 -0
- data/docs/Application.md +20 -0
- data/docs/ApplicationAPIKey.md +14 -0
- data/docs/ApplicationApiHealth.md +9 -0
- data/docs/ApplicationCustomer.md +16 -0
- data/docs/ApplicationCustomerEntity.md +8 -0
- data/docs/ApplicationCustomerSearch.md +10 -0
- data/docs/ApplicationEntity.md +8 -0
- data/docs/ApplicationEvent.md +15 -0
- data/docs/ApplicationSession.md +18 -0
- data/docs/ApplicationSessionEntity.md +8 -0
- data/docs/ApplicationStorage.md +15 -0
- data/docs/ApplicationStorageData.md +7 -0
- data/docs/ApplicationStorageTuple.md +13 -0
- data/docs/Attribute.md +20 -0
- data/docs/AttributeQuery.md +7 -0
- data/docs/Binding.md +9 -0
- data/docs/Campaign.md +30 -0
- data/docs/CampaignAnalytics.md +22 -0
- data/docs/CampaignCopy.md +9 -0
- data/docs/CampaignEntity.md +8 -0
- data/docs/CampaignSearch.md +8 -0
- data/docs/CampaignSet.md +11 -0
- data/docs/CampaignSetBranchNode.md +11 -0
- data/docs/CampaignSetLeafNode.md +9 -0
- data/docs/CampaignSetNode.md +8 -0
- data/docs/CartItem.md +19 -0
- data/docs/CartItemAdjustment.md +10 -0
- data/docs/Change.md +13 -0
- data/docs/CodeGeneratorSettings.md +9 -0
- data/docs/Coupon.md +21 -0
- data/docs/CouponConstraints.md +10 -0
- data/docs/CouponRejectionReason.md +10 -0
- data/docs/CouponReservations.md +8 -0
- data/docs/CouponSearch.md +8 -0
- data/docs/CouponValue.md +8 -0
- data/docs/CreateApplicationAPIKey.md +9 -0
- data/docs/CustomerActivityReport.md +20 -0
- data/docs/CustomerAnalytics.md +14 -0
- data/docs/CustomerProfile.md +15 -0
- data/docs/CustomerProfileSearchQuery.md +10 -0
- data/docs/CustomerSession.md +20 -0
- data/docs/EmailEntity.md +8 -0
- data/docs/Entity.md +9 -0
- data/docs/Environment.md +14 -0
- data/docs/ErrorResponse.md +9 -0
- data/docs/ErrorSource.md +10 -0
- data/docs/Event.md +17 -0
- data/docs/EventType.md +19 -0
- data/docs/Export.md +13 -0
- data/docs/FeatureFlag.md +11 -0
- data/docs/FeatureFlags.md +11 -0
- data/docs/FeaturesFeed.md +9 -0
- data/docs/FuncArgDef.md +9 -0
- data/docs/FunctionDef.md +12 -0
- data/docs/Import.md +13 -0
- data/docs/ImportCoupons.md +8 -0
- data/docs/InlineResponse200.md +9 -0
- data/docs/InlineResponse2001.md +9 -0
- data/docs/InlineResponse20010.md +9 -0
- data/docs/InlineResponse20011.md +9 -0
- data/docs/InlineResponse20012.md +9 -0
- data/docs/InlineResponse20013.md +9 -0
- data/docs/InlineResponse20014.md +9 -0
- data/docs/InlineResponse20015.md +9 -0
- data/docs/InlineResponse20016.md +9 -0
- data/docs/InlineResponse20017.md +9 -0
- data/docs/InlineResponse20018.md +9 -0
- data/docs/InlineResponse20019.md +9 -0
- data/docs/InlineResponse2002.md +9 -0
- data/docs/InlineResponse20020.md +9 -0
- data/docs/InlineResponse20021.md +9 -0
- data/docs/InlineResponse20022.md +9 -0
- data/docs/InlineResponse20023.md +9 -0
- data/docs/InlineResponse20024.md +9 -0
- data/docs/InlineResponse20025.md +9 -0
- data/docs/InlineResponse20026.md +9 -0
- data/docs/InlineResponse20027.md +9 -0
- data/docs/InlineResponse20028.md +9 -0
- data/docs/InlineResponse2003.md +9 -0
- data/docs/InlineResponse2004.md +9 -0
- data/docs/InlineResponse2005.md +9 -0
- data/docs/InlineResponse2006.md +9 -0
- data/docs/InlineResponse2007.md +9 -0
- data/docs/InlineResponse2008.md +9 -0
- data/docs/InlineResponse2009.md +9 -0
- data/docs/IntegrationApi.md +558 -0
- data/docs/IntegrationEntity.md +9 -0
- data/docs/IntegrationProfileEntity.md +8 -0
- data/docs/IntegrationState.md +11 -0
- data/docs/LedgerEntry.md +17 -0
- data/docs/LibraryAttribute.md +14 -0
- data/docs/LimitConfig.md +10 -0
- data/docs/LoginParams.md +9 -0
- data/docs/Loyalty.md +8 -0
- data/docs/LoyaltyLedger.md +9 -0
- data/docs/LoyaltyLedgerEntry.md +17 -0
- data/docs/LoyaltyMembership.md +9 -0
- data/docs/LoyaltyPoints.md +11 -0
- data/docs/LoyaltyProgram.md +15 -0
- data/docs/LoyaltyProgramBalance.md +8 -0
- data/docs/LoyaltyProgramLedgers.md +11 -0
- data/docs/LoyaltySubLedger.md +10 -0
- data/docs/ManagementApi.md +5067 -0
- data/docs/ManagerConfig.md +8 -0
- data/docs/Meta.md +11 -0
- data/docs/MiscUpdateUserLatestFeature.md +8 -0
- data/docs/MultiApplicationEntity.md +8 -0
- data/docs/MutableEntity.md +8 -0
- data/docs/NewAccount.md +8 -0
- data/docs/NewAccountSignUp.md +10 -0
- data/docs/NewApplication.md +15 -0
- data/docs/NewApplicationAPIKey.md +15 -0
- data/docs/NewApplicationStorage.md +10 -0
- data/docs/NewApplicationStorageData.md +7 -0
- data/docs/NewApplicationStorageTuple.md +9 -0
- data/docs/NewAttribute.md +15 -0
- data/docs/NewCampaign.md +19 -0
- data/docs/NewCampaignSet.md +9 -0
- data/docs/NewCoupons.md +16 -0
- data/docs/NewCustomerProfile.md +8 -0
- data/docs/NewCustomerSession.md +15 -0
- data/docs/NewEvent.md +11 -0
- data/docs/NewEventType.md +17 -0
- data/docs/NewFeatureFlags.md +10 -0
- data/docs/NewImport.md +8 -0
- data/docs/NewInvitation.md +11 -0
- data/docs/NewInviteEmail.md +9 -0
- data/docs/NewLoyaltyProgram.md +13 -0
- data/docs/NewPassword.md +9 -0
- data/docs/NewPasswordEmail.md +8 -0
- data/docs/NewReferral.md +12 -0
- data/docs/NewRole.md +11 -0
- data/docs/NewRuleset.md +11 -0
- data/docs/NewTemplateDef.md +14 -0
- data/docs/NewUser.md +11 -0
- data/docs/NewWebhook.md +15 -0
- data/docs/Referral.md +17 -0
- data/docs/Role.md +13 -0
- data/docs/RoleAssign.md +9 -0
- data/docs/RoleMembership.md +9 -0
- data/docs/Rule.md +12 -0
- data/docs/Ruleset.md +16 -0
- data/docs/Session.md +10 -0
- data/docs/SlotDef.md +13 -0
- data/docs/TemplateArgDef.md +11 -0
- data/docs/TemplateDef.md +18 -0
- data/docs/UpdateAccount.md +10 -0
- data/docs/UpdateCampaign.md +19 -0
- data/docs/UpdateCoupon.md +12 -0
- data/docs/UpdateCouponBatch.md +12 -0
- data/docs/UpdateLoyaltyProgram.md +12 -0
- data/docs/UpdateRole.md +11 -0
- data/docs/UpdateUser.md +16 -0
- data/docs/User.md +19 -0
- data/docs/UserEntity.md +8 -0
- data/docs/Webhook.md +19 -0
- data/docs/WebhookActivationLogEntry.md +12 -0
- data/docs/WebhookLogEntry.md +17 -0
- data/fck.rb +64 -0
- data/git_push.sh +55 -0
- data/lib/talon_one.rb +200 -4
- data/lib/talon_one/api/integration_api.rb +531 -0
- data/lib/talon_one/api/management_api.rb +5520 -0
- data/lib/talon_one/api_client.rb +389 -0
- data/lib/talon_one/api_error.rb +38 -0
- data/lib/talon_one/configuration.rb +223 -0
- data/lib/talon_one/models/access_log_entry.rb +280 -0
- data/lib/talon_one/models/account.rb +462 -0
- data/lib/talon_one/models/account_analytics.rb +384 -0
- data/lib/talon_one/models/account_entity.rb +189 -0
- data/lib/talon_one/models/account_limits.rb +341 -0
- data/lib/talon_one/models/api_error.rb +213 -0
- data/lib/talon_one/models/application.rb +482 -0
- data/lib/talon_one/models/application_api_health.rb +239 -0
- data/lib/talon_one/models/application_api_key.rb +279 -0
- data/lib/talon_one/models/application_customer.rb +312 -0
- data/lib/talon_one/models/application_customer_entity.rb +184 -0
- data/lib/talon_one/models/application_customer_search.rb +206 -0
- data/lib/talon_one/models/application_entity.rb +189 -0
- data/lib/talon_one/models/application_event.rb +287 -0
- data/lib/talon_one/models/application_session.rb +368 -0
- data/lib/talon_one/models/application_session_entity.rb +189 -0
- data/lib/talon_one/models/application_storage.rb +292 -0
- data/lib/talon_one/models/application_storage_data.rb +175 -0
- data/lib/talon_one/models/application_storage_tuple.rb +283 -0
- data/lib/talon_one/models/attribute.rb +416 -0
- data/lib/talon_one/models/attribute_query.rb +174 -0
- data/lib/talon_one/models/binding.rb +206 -0
- data/lib/talon_one/models/campaign.rb +514 -0
- data/lib/talon_one/models/campaign_analytics.rb +399 -0
- data/lib/talon_one/models/campaign_copy.rb +201 -0
- data/lib/talon_one/models/campaign_entity.rb +189 -0
- data/lib/talon_one/models/campaign_search.rb +189 -0
- data/lib/talon_one/models/campaign_set.rb +234 -0
- data/lib/talon_one/models/campaign_set_branch_node.rb +282 -0
- data/lib/talon_one/models/campaign_set_leaf_node.rb +238 -0
- data/lib/talon_one/models/campaign_set_node.rb +188 -0
- data/lib/talon_one/models/cart_item.rb +365 -0
- data/lib/talon_one/models/cart_item_adjustment.rb +248 -0
- data/lib/talon_one/models/change.rb +255 -0
- data/lib/talon_one/models/code_generator_settings.rb +225 -0
- data/lib/talon_one/models/coupon.rb +392 -0
- data/lib/talon_one/models/coupon_constraints.rb +228 -0
- data/lib/talon_one/models/coupon_rejection_reason.rb +251 -0
- data/lib/talon_one/models/coupon_reservations.rb +191 -0
- data/lib/talon_one/models/coupon_search.rb +189 -0
- data/lib/talon_one/models/coupon_value.rb +199 -0
- data/lib/talon_one/models/create_application_api_key.rb +204 -0
- data/lib/talon_one/models/customer_activity_report.rb +365 -0
- data/lib/talon_one/models/customer_analytics.rb +280 -0
- data/lib/talon_one/models/customer_profile.rb +297 -0
- data/lib/talon_one/models/customer_profile_search_query.rb +206 -0
- data/lib/talon_one/models/customer_session.rb +407 -0
- data/lib/talon_one/models/email_entity.rb +189 -0
- data/lib/talon_one/models/entity.rb +204 -0
- data/lib/talon_one/models/environment.rb +285 -0
- data/lib/talon_one/models/error_response.rb +201 -0
- data/lib/talon_one/models/error_source.rb +205 -0
- data/lib/talon_one/models/event.rb +356 -0
- data/lib/talon_one/models/event_type.rb +426 -0
- data/lib/talon_one/models/export.rb +299 -0
- data/lib/talon_one/models/feature_flag.rb +224 -0
- data/lib/talon_one/models/feature_flags.rb +220 -0
- data/lib/talon_one/models/features_feed.rb +193 -0
- data/lib/talon_one/models/func_arg_def.rb +243 -0
- data/lib/talon_one/models/function_def.rb +260 -0
- data/lib/talon_one/models/import.rb +318 -0
- data/lib/talon_one/models/import_coupons.rb +188 -0
- data/lib/talon_one/models/inline_response_200.rb +204 -0
- data/lib/talon_one/models/inline_response_200_1.rb +204 -0
- data/lib/talon_one/models/inline_response_200_10.rb +204 -0
- data/lib/talon_one/models/inline_response_200_11.rb +204 -0
- data/lib/talon_one/models/inline_response_200_12.rb +204 -0
- data/lib/talon_one/models/inline_response_200_13.rb +204 -0
- data/lib/talon_one/models/inline_response_200_14.rb +204 -0
- data/lib/talon_one/models/inline_response_200_15.rb +204 -0
- data/lib/talon_one/models/inline_response_200_16.rb +204 -0
- data/lib/talon_one/models/inline_response_200_17.rb +204 -0
- data/lib/talon_one/models/inline_response_200_18.rb +204 -0
- data/lib/talon_one/models/inline_response_200_19.rb +204 -0
- data/lib/talon_one/models/inline_response_200_2.rb +204 -0
- data/lib/talon_one/models/inline_response_200_20.rb +204 -0
- data/lib/talon_one/models/inline_response_200_21.rb +204 -0
- data/lib/talon_one/models/inline_response_200_22.rb +204 -0
- data/lib/talon_one/models/inline_response_200_23.rb +204 -0
- data/lib/talon_one/models/inline_response_200_24.rb +204 -0
- data/lib/talon_one/models/inline_response_200_25.rb +204 -0
- data/lib/talon_one/models/inline_response_200_26.rb +204 -0
- data/lib/talon_one/models/inline_response_200_27.rb +204 -0
- data/lib/talon_one/models/inline_response_200_28.rb +204 -0
- data/lib/talon_one/models/inline_response_200_3.rb +204 -0
- data/lib/talon_one/models/inline_response_200_4.rb +204 -0
- data/lib/talon_one/models/inline_response_200_5.rb +204 -0
- data/lib/talon_one/models/inline_response_200_6.rb +204 -0
- data/lib/talon_one/models/inline_response_200_7.rb +204 -0
- data/lib/talon_one/models/inline_response_200_8.rb +204 -0
- data/lib/talon_one/models/inline_response_200_9.rb +204 -0
- data/lib/talon_one/models/integration_entity.rb +204 -0
- data/lib/talon_one/models/integration_profile_entity.rb +184 -0
- data/lib/talon_one/models/integration_state.rb +226 -0
- data/lib/talon_one/models/ledger_entry.rb +320 -0
- data/lib/talon_one/models/library_attribute.rb +330 -0
- data/lib/talon_one/models/limit_config.rb +274 -0
- data/lib/talon_one/models/login_params.rb +205 -0
- data/lib/talon_one/models/loyalty.rb +192 -0
- data/lib/talon_one/models/loyalty_ledger.rb +202 -0
- data/lib/talon_one/models/loyalty_ledger_entry.rb +336 -0
- data/lib/talon_one/models/loyalty_membership.rb +199 -0
- data/lib/talon_one/models/loyalty_points.rb +220 -0
- data/lib/talon_one/models/loyalty_program.rb +297 -0
- data/lib/talon_one/models/loyalty_program_balance.rb +189 -0
- data/lib/talon_one/models/loyalty_program_ledgers.rb +232 -0
- data/lib/talon_one/models/loyalty_sub_ledger.rb +213 -0
- data/lib/talon_one/models/manager_config.rb +188 -0
- data/lib/talon_one/models/meta.rb +212 -0
- data/lib/talon_one/models/misc_update_user_latest_feature.rb +183 -0
- data/lib/talon_one/models/multi_application_entity.rb +191 -0
- data/lib/talon_one/models/mutable_entity.rb +189 -0
- data/lib/talon_one/models/new_account.rb +207 -0
- data/lib/talon_one/models/new_account_sign_up.rb +238 -0
- data/lib/talon_one/models/new_application.rb +404 -0
- data/lib/talon_one/models/new_application_api_key.rb +295 -0
- data/lib/talon_one/models/new_application_storage.rb +214 -0
- data/lib/talon_one/models/new_application_storage_data.rb +175 -0
- data/lib/talon_one/models/new_application_storage_tuple.rb +222 -0
- data/lib/talon_one/models/new_attribute.rb +337 -0
- data/lib/talon_one/models/new_campaign.rb +378 -0
- data/lib/talon_one/models/new_campaign_set.rb +204 -0
- data/lib/talon_one/models/new_coupons.rb +334 -0
- data/lib/talon_one/models/new_customer_profile.rb +184 -0
- data/lib/talon_one/models/new_customer_session.rb +295 -0
- data/lib/talon_one/models/new_event.rb +268 -0
- data/lib/talon_one/models/new_event_type.rb +396 -0
- data/lib/talon_one/models/new_feature_flags.rb +204 -0
- data/lib/talon_one/models/new_import.rb +224 -0
- data/lib/talon_one/models/new_invitation.rb +226 -0
- data/lib/talon_one/models/new_invite_email.rb +240 -0
- data/lib/talon_one/models/new_loyalty_program.rb +257 -0
- data/lib/talon_one/models/new_password.rb +222 -0
- data/lib/talon_one/models/new_password_email.rb +207 -0
- data/lib/talon_one/models/new_referral.rb +234 -0
- data/lib/talon_one/models/new_role.rb +232 -0
- data/lib/talon_one/models/new_ruleset.rb +228 -0
- data/lib/talon_one/models/new_template_def.rb +308 -0
- data/lib/talon_one/models/new_user.rb +248 -0
- data/lib/talon_one/models/new_webhook.rb +330 -0
- data/lib/talon_one/models/referral.rb +348 -0
- data/lib/talon_one/models/role.rb +247 -0
- data/lib/talon_one/models/role_assign.rb +209 -0
- data/lib/talon_one/models/role_membership.rb +204 -0
- data/lib/talon_one/models/rule.rb +245 -0
- data/lib/talon_one/models/ruleset.rb +299 -0
- data/lib/talon_one/models/session.rb +219 -0
- data/lib/talon_one/models/slot_def.rb +254 -0
- data/lib/talon_one/models/template_arg_def.rb +293 -0
- data/lib/talon_one/models/template_def.rb +398 -0
- data/lib/talon_one/models/update_account.rb +233 -0
- data/lib/talon_one/models/update_campaign.rb +373 -0
- data/lib/talon_one/models/update_coupon.rb +249 -0
- data/lib/talon_one/models/update_coupon_batch.rb +254 -0
- data/lib/talon_one/models/update_loyalty_program.rb +227 -0
- data/lib/talon_one/models/update_role.rb +216 -0
- data/lib/talon_one/models/update_user.rb +306 -0
- data/lib/talon_one/models/user.rb +381 -0
- data/lib/talon_one/models/user_entity.rb +189 -0
- data/lib/talon_one/models/webhook.rb +392 -0
- data/lib/talon_one/models/webhook_activation_log_entry.rb +250 -0
- data/lib/talon_one/models/webhook_log_entry.rb +305 -0
- data/lib/talon_one/version.rb +15 -0
- data/spec/api/integration_api_spec.rb +147 -0
- data/spec/api/management_api_spec.rb +1299 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/access_log_entry_spec.rb +77 -0
- data/spec/models/account_analytics_spec.rb +119 -0
- data/spec/models/account_entity_spec.rb +41 -0
- data/spec/models/account_limits_spec.rb +101 -0
- data/spec/models/account_spec.rb +147 -0
- data/spec/models/api_error_spec.rb +53 -0
- data/spec/models/application_api_health_spec.rb +51 -0
- data/spec/models/application_api_key_spec.rb +77 -0
- data/spec/models/application_customer_entity_spec.rb +41 -0
- data/spec/models/application_customer_search_spec.rb +53 -0
- data/spec/models/application_customer_spec.rb +89 -0
- data/spec/models/application_entity_spec.rb +41 -0
- data/spec/models/application_event_spec.rb +83 -0
- data/spec/models/application_session_entity_spec.rb +41 -0
- data/spec/models/application_session_spec.rb +105 -0
- data/spec/models/application_spec.rb +117 -0
- data/spec/models/application_storage_data_spec.rb +35 -0
- data/spec/models/application_storage_spec.rb +83 -0
- data/spec/models/application_storage_tuple_spec.rb +71 -0
- data/spec/models/attribute_query_spec.rb +35 -0
- data/spec/models/attribute_spec.rb +121 -0
- data/spec/models/binding_spec.rb +47 -0
- data/spec/models/campaign_analytics_spec.rb +125 -0
- data/spec/models/campaign_copy_spec.rb +47 -0
- data/spec/models/campaign_entity_spec.rb +41 -0
- data/spec/models/campaign_search_spec.rb +41 -0
- data/spec/models/campaign_set_branch_node_spec.rb +67 -0
- data/spec/models/campaign_set_leaf_node_spec.rb +51 -0
- data/spec/models/campaign_set_node_spec.rb +41 -0
- data/spec/models/campaign_set_spec.rb +59 -0
- data/spec/models/campaign_spec.rb +181 -0
- data/spec/models/cart_item_adjustment_spec.rb +53 -0
- data/spec/models/cart_item_spec.rb +107 -0
- data/spec/models/change_spec.rb +71 -0
- data/spec/models/code_generator_settings_spec.rb +47 -0
- data/spec/models/coupon_constraints_spec.rb +53 -0
- data/spec/models/coupon_rejection_reason_spec.rb +57 -0
- data/spec/models/coupon_reservations_spec.rb +41 -0
- data/spec/models/coupon_search_spec.rb +41 -0
- data/spec/models/coupon_spec.rb +119 -0
- data/spec/models/coupon_value_spec.rb +41 -0
- data/spec/models/create_application_api_key_spec.rb +47 -0
- data/spec/models/customer_activity_report_spec.rb +113 -0
- data/spec/models/customer_analytics_spec.rb +77 -0
- data/spec/models/customer_profile_search_query_spec.rb +53 -0
- data/spec/models/customer_profile_spec.rb +83 -0
- data/spec/models/customer_session_spec.rb +117 -0
- data/spec/models/email_entity_spec.rb +41 -0
- data/spec/models/entity_spec.rb +47 -0
- data/spec/models/environment_spec.rb +77 -0
- data/spec/models/error_response_spec.rb +47 -0
- data/spec/models/error_source_spec.rb +53 -0
- data/spec/models/event_spec.rb +95 -0
- data/spec/models/event_type_spec.rb +115 -0
- data/spec/models/export_spec.rb +75 -0
- data/spec/models/feature_flag_spec.rb +59 -0
- data/spec/models/feature_flags_spec.rb +59 -0
- data/spec/models/features_feed_spec.rb +47 -0
- data/spec/models/func_arg_def_spec.rb +51 -0
- data/spec/models/function_def_spec.rb +65 -0
- data/spec/models/import_coupons_spec.rb +41 -0
- data/spec/models/import_spec.rb +75 -0
- data/spec/models/inline_response_200_10_spec.rb +47 -0
- data/spec/models/inline_response_200_11_spec.rb +47 -0
- data/spec/models/inline_response_200_12_spec.rb +47 -0
- data/spec/models/inline_response_200_13_spec.rb +47 -0
- data/spec/models/inline_response_200_14_spec.rb +47 -0
- data/spec/models/inline_response_200_15_spec.rb +47 -0
- data/spec/models/inline_response_200_16_spec.rb +47 -0
- data/spec/models/inline_response_200_17_spec.rb +47 -0
- data/spec/models/inline_response_200_18_spec.rb +47 -0
- data/spec/models/inline_response_200_19_spec.rb +47 -0
- data/spec/models/inline_response_200_1_spec.rb +47 -0
- data/spec/models/inline_response_200_20_spec.rb +47 -0
- data/spec/models/inline_response_200_21_spec.rb +47 -0
- data/spec/models/inline_response_200_22_spec.rb +47 -0
- data/spec/models/inline_response_200_23_spec.rb +47 -0
- data/spec/models/inline_response_200_24_spec.rb +47 -0
- data/spec/models/inline_response_200_25_spec.rb +47 -0
- data/spec/models/inline_response_200_26_spec.rb +47 -0
- data/spec/models/inline_response_200_27_spec.rb +47 -0
- data/spec/models/inline_response_200_28_spec.rb +47 -0
- data/spec/models/inline_response_200_2_spec.rb +47 -0
- data/spec/models/inline_response_200_3_spec.rb +47 -0
- data/spec/models/inline_response_200_4_spec.rb +47 -0
- data/spec/models/inline_response_200_5_spec.rb +47 -0
- data/spec/models/inline_response_200_6_spec.rb +47 -0
- data/spec/models/inline_response_200_7_spec.rb +47 -0
- data/spec/models/inline_response_200_8_spec.rb +47 -0
- data/spec/models/inline_response_200_9_spec.rb +47 -0
- data/spec/models/inline_response_200_spec.rb +47 -0
- data/spec/models/integration_entity_spec.rb +47 -0
- data/spec/models/integration_profile_entity_spec.rb +41 -0
- data/spec/models/integration_state_spec.rb +59 -0
- data/spec/models/ledger_entry_spec.rb +95 -0
- data/spec/models/library_attribute_spec.rb +85 -0
- data/spec/models/limit_config_spec.rb +61 -0
- data/spec/models/login_params_spec.rb +47 -0
- data/spec/models/loyalty_ledger_entry_spec.rb +99 -0
- data/spec/models/loyalty_ledger_spec.rb +47 -0
- data/spec/models/loyalty_membership_spec.rb +47 -0
- data/spec/models/loyalty_points_spec.rb +59 -0
- data/spec/models/loyalty_program_balance_spec.rb +41 -0
- data/spec/models/loyalty_program_ledgers_spec.rb +59 -0
- data/spec/models/loyalty_program_spec.rb +83 -0
- data/spec/models/loyalty_spec.rb +41 -0
- data/spec/models/loyalty_sub_ledger_spec.rb +53 -0
- data/spec/models/manager_config_spec.rb +41 -0
- data/spec/models/meta_spec.rb +59 -0
- data/spec/models/misc_update_user_latest_feature_spec.rb +41 -0
- data/spec/models/multi_application_entity_spec.rb +41 -0
- data/spec/models/mutable_entity_spec.rb +41 -0
- data/spec/models/new_account_sign_up_spec.rb +53 -0
- data/spec/models/new_account_spec.rb +41 -0
- data/spec/models/new_application_api_key_spec.rb +83 -0
- data/spec/models/new_application_spec.rb +87 -0
- data/spec/models/new_application_storage_data_spec.rb +35 -0
- data/spec/models/new_application_storage_spec.rb +53 -0
- data/spec/models/new_application_storage_tuple_spec.rb +47 -0
- data/spec/models/new_attribute_spec.rb +91 -0
- data/spec/models/new_campaign_set_spec.rb +47 -0
- data/spec/models/new_campaign_spec.rb +115 -0
- data/spec/models/new_coupons_spec.rb +89 -0
- data/spec/models/new_customer_profile_spec.rb +41 -0
- data/spec/models/new_customer_session_spec.rb +87 -0
- data/spec/models/new_event_spec.rb +59 -0
- data/spec/models/new_event_type_spec.rb +103 -0
- data/spec/models/new_feature_flags_spec.rb +53 -0
- data/spec/models/new_import_spec.rb +45 -0
- data/spec/models/new_invitation_spec.rb +59 -0
- data/spec/models/new_invite_email_spec.rb +47 -0
- data/spec/models/new_loyalty_program_spec.rb +71 -0
- data/spec/models/new_password_email_spec.rb +41 -0
- data/spec/models/new_password_spec.rb +47 -0
- data/spec/models/new_referral_spec.rb +65 -0
- data/spec/models/new_role_spec.rb +59 -0
- data/spec/models/new_ruleset_spec.rb +59 -0
- data/spec/models/new_template_def_spec.rb +77 -0
- data/spec/models/new_user_spec.rb +59 -0
- data/spec/models/new_webhook_spec.rb +87 -0
- data/spec/models/referral_spec.rb +95 -0
- data/spec/models/role_assign_spec.rb +47 -0
- data/spec/models/role_membership_spec.rb +47 -0
- data/spec/models/role_spec.rb +71 -0
- data/spec/models/rule_spec.rb +65 -0
- data/spec/models/ruleset_spec.rb +89 -0
- data/spec/models/session_spec.rb +53 -0
- data/spec/models/slot_def_spec.rb +71 -0
- data/spec/models/template_arg_def_spec.rb +63 -0
- data/spec/models/template_def_spec.rb +101 -0
- data/spec/models/update_account_spec.rb +53 -0
- data/spec/models/update_campaign_spec.rb +115 -0
- data/spec/models/update_coupon_batch_spec.rb +65 -0
- data/spec/models/update_coupon_spec.rb +65 -0
- data/spec/models/update_loyalty_program_spec.rb +65 -0
- data/spec/models/update_role_spec.rb +59 -0
- data/spec/models/update_user_spec.rb +93 -0
- data/spec/models/user_entity_spec.rb +41 -0
- data/spec/models/user_spec.rb +111 -0
- data/spec/models/webhook_activation_log_entry_spec.rb +65 -0
- data/spec/models/webhook_log_entry_spec.rb +95 -0
- data/spec/models/webhook_spec.rb +111 -0
- data/spec/spec_helper.rb +111 -0
- data/talon_one.gemspec +43 -15
- metadata +827 -33
- data/.gitignore +0 -3
- data/.travis.yml +0 -5
- data/lib/integration/client.rb +0 -88
- data/lib/integration/client_error.rb +0 -9
- data/lib/integration/customer_profile.rb +0 -21
- data/lib/integration/effect.rb +0 -20
- data/lib/integration/event.rb +0 -45
- data/lib/integration/referral_code.rb +0 -49
- data/lib/integration/rule_engine_result.rb +0 -23
- data/lib/integration/search_profiles_result.rb +0 -17
- data/lib/management/client.rb +0 -112
- data/test/test_helper.rb +0 -20
- data/test/test_integration_api_live.rb +0 -64
- data/test/test_integration_params.rb +0 -23
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/lib/integration/client.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'openssl'
|
2
|
-
require 'oj'
|
3
|
-
|
4
|
-
require_relative './search_profiles_result'
|
5
|
-
require_relative './rule_engine_result'
|
6
|
-
require_relative './referral_code'
|
7
|
-
require_relative './client_error'
|
8
|
-
|
9
|
-
module TalonOne
|
10
|
-
module Integration
|
11
|
-
# Basic REST client for the TalonOne integration API
|
12
|
-
class Client
|
13
|
-
def initialize(config = {})
|
14
|
-
@endpoint = URI(
|
15
|
-
config[:endpoint] || ENV["TALONONE_ENDPOINT"] || "https://example.talon.one"
|
16
|
-
)
|
17
|
-
@endpoint.path = @endpoint.path.sub(/\/+$/, '')
|
18
|
-
@http = Net::HTTP.new(@endpoint.host, @endpoint.port)
|
19
|
-
@http.use_ssl = @endpoint.scheme == "https"
|
20
|
-
|
21
|
-
@application_id = config[:application_id] || ENV["TALONONE_APP_ID"]
|
22
|
-
@application_key = [config[:application_key] || ENV["TALONONE_APP_KEY"]].pack('H*')
|
23
|
-
end
|
24
|
-
|
25
|
-
def request(method, path, payload = nil, result = TalonOne::Integration::RuleEngineResult)
|
26
|
-
req = Net::HTTP.const_get(method).new(@endpoint.path + path)
|
27
|
-
req.body = Oj.dump payload, oj_options(:compat)
|
28
|
-
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('md5'), @application_key, req.body)
|
29
|
-
|
30
|
-
req['Content-Type'] = 'application/json'
|
31
|
-
req['Content-Signature'] = "signer=#{@application_id}; signature=#{signature}"
|
32
|
-
|
33
|
-
res = @http.request(req)
|
34
|
-
|
35
|
-
if res.code[0] == '2'
|
36
|
-
result.new(Oj.load(res.body, oj_options(:strict)))
|
37
|
-
else
|
38
|
-
raise TalonOne::Integration::ClientError.new("#{method.upcase} #{path} -> #{res.code} #{res.body}")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def track_event(session_id, event_type, value)
|
43
|
-
request "Post", "/v1/events", { sessionId: session_id, type: event_type, attributes: value }
|
44
|
-
end
|
45
|
-
|
46
|
-
def update_customer_session(session_id, data)
|
47
|
-
request "Put", "/v1/customer_sessions/#{session_id}", data
|
48
|
-
end
|
49
|
-
|
50
|
-
def update_customer_profile(profile_id, data)
|
51
|
-
request "Put", "/v1/customer_profiles/#{profile_id}", data
|
52
|
-
end
|
53
|
-
|
54
|
-
def close_customer_session(session_id)
|
55
|
-
update_customer_session session_id, { state: "closed" }
|
56
|
-
end
|
57
|
-
|
58
|
-
def create_referral_code(campaign_id, advocate_profile_id, friend_id: "", start: nil, expire: nil)
|
59
|
-
newReferral = {
|
60
|
-
campaignId: campaign_id,
|
61
|
-
advocateProfileIntegrationId: advocate_profile_id,
|
62
|
-
friendProfileIntegrationId: friend_id,
|
63
|
-
}
|
64
|
-
if start
|
65
|
-
newReferral[:startDate] = start
|
66
|
-
end
|
67
|
-
if expire
|
68
|
-
newReferral[:expiryDate] = expire
|
69
|
-
end
|
70
|
-
request "Post", "/v1/referrals", newReferral, TalonOne::Integration::ReferralCode
|
71
|
-
end
|
72
|
-
|
73
|
-
def search_profiles_by_attributes(profileAttr)
|
74
|
-
request "Post", "/v1/customer_profiles_search", { attributes: profileAttr }, TalonOne::Integration::SearchProfilesResult
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
|
-
def oj_options(mode)
|
80
|
-
{ :mode => mode,
|
81
|
-
:class_cache => false,
|
82
|
-
:escape_mode => :json,
|
83
|
-
:bigdecimal_as_decimal => true,
|
84
|
-
:bigdecimal_load => :bigdecimal }
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module TalonOne
|
2
|
-
module Integration
|
3
|
-
class CustomerProfile
|
4
|
-
def initialize(raw_data)
|
5
|
-
@raw = raw_data
|
6
|
-
end
|
7
|
-
|
8
|
-
def id
|
9
|
-
@raw["id"]
|
10
|
-
end
|
11
|
-
|
12
|
-
def created
|
13
|
-
@raw["created"]
|
14
|
-
end
|
15
|
-
|
16
|
-
def integration_id
|
17
|
-
@raw["integrationId"]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/integration/effect.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module TalonOne
|
2
|
-
module Integration
|
3
|
-
class Effect
|
4
|
-
def initialize(raw_array)
|
5
|
-
@campaign_id = raw_array[0]
|
6
|
-
@ruleset_id = raw_array[1]
|
7
|
-
@ruleset_index = raw_array[2]
|
8
|
-
@raw = raw_array[3]
|
9
|
-
end
|
10
|
-
|
11
|
-
def function
|
12
|
-
@raw[0]
|
13
|
-
end
|
14
|
-
|
15
|
-
def args
|
16
|
-
@raw[1..-1]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/integration/event.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require_relative './effect'
|
2
|
-
|
3
|
-
module TalonOne
|
4
|
-
module Integration
|
5
|
-
class Event
|
6
|
-
def initialize(raw_data)
|
7
|
-
@raw = raw_data
|
8
|
-
end
|
9
|
-
|
10
|
-
def type
|
11
|
-
@raw["type"]
|
12
|
-
end
|
13
|
-
|
14
|
-
def session_id
|
15
|
-
@raw["sessionId"]
|
16
|
-
end
|
17
|
-
|
18
|
-
def attributes
|
19
|
-
@raw["attributes"]
|
20
|
-
end
|
21
|
-
|
22
|
-
def effects
|
23
|
-
@effects ||= @raw["effects"].map do |raw_array|
|
24
|
-
TalonOne::Integration::Effect.new raw_array
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def accepted_coupon?
|
29
|
-
effects.any? {|e| e.function == "acceptCoupon"}
|
30
|
-
end
|
31
|
-
|
32
|
-
def rejected_coupon?
|
33
|
-
!accepted_coupon? && effects.any? {|e| e.function == "rejectCoupon"}
|
34
|
-
end
|
35
|
-
|
36
|
-
def accepted_referral?
|
37
|
-
effects.any? {|e| e.function == "acceptReferral"}
|
38
|
-
end
|
39
|
-
|
40
|
-
def rejected_referral?
|
41
|
-
!accepted_referral? && effects.any? {|e| e.function == "rejectReferral"}
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module TalonOne
|
2
|
-
module Integration
|
3
|
-
class ReferralCode
|
4
|
-
def initialize(raw_data)
|
5
|
-
@raw = raw_data
|
6
|
-
end
|
7
|
-
|
8
|
-
def id
|
9
|
-
@raw["id"]
|
10
|
-
end
|
11
|
-
|
12
|
-
def campaign_id
|
13
|
-
@raw["campaignId"]
|
14
|
-
end
|
15
|
-
|
16
|
-
def created
|
17
|
-
@raw["created"]
|
18
|
-
end
|
19
|
-
|
20
|
-
def advocate_id
|
21
|
-
@raw["advocateProfileIntegrationId"]
|
22
|
-
end
|
23
|
-
|
24
|
-
def code
|
25
|
-
@raw["code"]
|
26
|
-
end
|
27
|
-
|
28
|
-
def friend_id
|
29
|
-
@raw["friendProfileIntegrationId"]
|
30
|
-
end
|
31
|
-
|
32
|
-
def start_date
|
33
|
-
@raw["startDate"]
|
34
|
-
end
|
35
|
-
|
36
|
-
def expiry_date
|
37
|
-
@raw["expiryDate"]
|
38
|
-
end
|
39
|
-
|
40
|
-
def usage_count
|
41
|
-
@raw["usageCount"]
|
42
|
-
end
|
43
|
-
|
44
|
-
def usage_limit
|
45
|
-
@raw["usageLimit"]
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require_relative './event'
|
2
|
-
|
3
|
-
module TalonOne
|
4
|
-
module Integration
|
5
|
-
class RuleEngineResult
|
6
|
-
def initialize(raw_data)
|
7
|
-
@raw = raw_data
|
8
|
-
end
|
9
|
-
|
10
|
-
def session
|
11
|
-
@raw["session"]
|
12
|
-
end
|
13
|
-
|
14
|
-
def profile
|
15
|
-
@raw["profile"]
|
16
|
-
end
|
17
|
-
|
18
|
-
def event
|
19
|
-
@event ||= TalonOne::Integration::Event.new(@raw["event"])
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative './customer_profile'
|
2
|
-
|
3
|
-
module TalonOne
|
4
|
-
module Integration
|
5
|
-
class SearchProfilesResult
|
6
|
-
def initialize(raw_data)
|
7
|
-
@raw = raw_data
|
8
|
-
end
|
9
|
-
|
10
|
-
def profiles
|
11
|
-
@profiles ||= @raw["data"].map do |raw_array|
|
12
|
-
TalonOne::Integration::CustomerProfile.new raw_array
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/management/client.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
module TalonOne
|
2
|
-
module Management
|
3
|
-
# Basic REST client for the TalonOne management API
|
4
|
-
class Client
|
5
|
-
def initialize(config = {})
|
6
|
-
@endpoint = URI(
|
7
|
-
config[:endpoint] || ENV["TALONONE_ENDPOINT"] || "https://app.talon.one"
|
8
|
-
)
|
9
|
-
@endpoint.path = @endpoint.path.sub(/\/+$/, '')
|
10
|
-
@http = Net::HTTP.new(@endpoint.host, @endpoint.port)
|
11
|
-
@http.use_ssl = @endpoint.scheme == "https"
|
12
|
-
@token = config[:token] || ENV["TALONONE_SESSION_TOKEN"]
|
13
|
-
if !@token
|
14
|
-
email = config[:email] || ENV["TALONONE_EMAIL"]
|
15
|
-
password = config[:password] || ENV["TALONONE_PASSWORD"]
|
16
|
-
if email && password
|
17
|
-
res = login(email, password)
|
18
|
-
@token = res["token"]
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def request(method, path, payload = nil)
|
24
|
-
req = Net::HTTP.const_get(method).new(@endpoint.path + path)
|
25
|
-
if @token
|
26
|
-
req["Authorization"] = "Bearer #{@token}"
|
27
|
-
end
|
28
|
-
if payload
|
29
|
-
req.body = payload.to_json
|
30
|
-
req['Content-Type'] = 'application/json'
|
31
|
-
end
|
32
|
-
res = @http.request(req)
|
33
|
-
if res.code[0] == '2'
|
34
|
-
res.body && JSON.parse(res.body)
|
35
|
-
else
|
36
|
-
raise "#{method.upcase} #{path} -> #{res.code} #{res.body}"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def get(path)
|
41
|
-
request "Get", path
|
42
|
-
end
|
43
|
-
|
44
|
-
def put(path, payload)
|
45
|
-
request "Put", path, payload
|
46
|
-
end
|
47
|
-
|
48
|
-
def post(path, payload)
|
49
|
-
request "Post", path, payload
|
50
|
-
end
|
51
|
-
|
52
|
-
def delete(path)
|
53
|
-
request "Delete", path
|
54
|
-
end
|
55
|
-
|
56
|
-
def login(email, password)
|
57
|
-
post "/v1/sessions", {"email" => email, "password" => password}
|
58
|
-
end
|
59
|
-
|
60
|
-
def create_application(params)
|
61
|
-
post "/v1/applications", params
|
62
|
-
end
|
63
|
-
|
64
|
-
def get_application(application_id)
|
65
|
-
get "/v1/applications/#{application_id}"
|
66
|
-
end
|
67
|
-
|
68
|
-
def delete_application(application_id)
|
69
|
-
delete "/v1/applications/#{application_id}"
|
70
|
-
end
|
71
|
-
|
72
|
-
def get_applications
|
73
|
-
get "/v1/applications"
|
74
|
-
end
|
75
|
-
|
76
|
-
def create_campaign(application_id, params)
|
77
|
-
post "/v1/applications/#{application_id}/campaigns", params
|
78
|
-
end
|
79
|
-
|
80
|
-
def get_campaign(application_id, campaign_id)
|
81
|
-
get "/v1/applications/#{application_id}/campaigns/#{campaign_id}"
|
82
|
-
end
|
83
|
-
|
84
|
-
def update_campaign(application_id, campaign_id, params)
|
85
|
-
put "/v1/applications/#{application_id}/campaigns/#{campaign_id}", params
|
86
|
-
end
|
87
|
-
|
88
|
-
def update_ruleset_for_campaign(application_id, campaign_id, params)
|
89
|
-
ruleset = post "/v1/applications/#{application_id}/campaigns/#{campaign_id}/rulesets", params
|
90
|
-
campaign = get_campaign(application_id, campaign_id)
|
91
|
-
campaign["activeRulesetId"] = ruleset["id"]
|
92
|
-
update_campaign(application_id, campaign_id, campaign)
|
93
|
-
return ruleset
|
94
|
-
end
|
95
|
-
|
96
|
-
def update_campaign_status(application_id, campaign_id, campaign_status)
|
97
|
-
campaign = get_campaign(application_id, campaign_id)
|
98
|
-
campaign["state"] = campaign_status
|
99
|
-
update_campaign(application_id, campaign_id, campaign)
|
100
|
-
end
|
101
|
-
|
102
|
-
def create_attribute(params)
|
103
|
-
post "/v1/attributes", params
|
104
|
-
end
|
105
|
-
|
106
|
-
def delete_attribute(attribute_id)
|
107
|
-
delete "/v1/attributes/#{attribute_id}"
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require 'talon_one'
|
3
|
-
|
4
|
-
class LiveApiTest < Minitest::Test
|
5
|
-
def integration_config
|
6
|
-
{}
|
7
|
-
end
|
8
|
-
|
9
|
-
def integration_client
|
10
|
-
@integration_client ||= TalonOne::Integration::Client.new integration_config
|
11
|
-
end
|
12
|
-
|
13
|
-
def management_config
|
14
|
-
{}
|
15
|
-
end
|
16
|
-
|
17
|
-
def management_client
|
18
|
-
@management_client ||= TalonOne::Management::Client.new management_config
|
19
|
-
end
|
20
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
class TestIntegrationApiLive < LiveApiTest
|
2
|
-
def setup
|
3
|
-
@app = management_client.create_application(
|
4
|
-
name: "Ruby SDK Test App #{rand(36**3).to_s(36)}",
|
5
|
-
key: "fefecafedeadbeef",
|
6
|
-
currency: "USD",
|
7
|
-
timezone: "UTC"
|
8
|
-
)
|
9
|
-
@campaign = management_client.create_campaign @app["id"], { name: "Test Campaign", state: 'disabled', tags: [], limits: [] }
|
10
|
-
@ruleset = management_client.update_ruleset_for_campaign @app["id"], @campaign["id"], rules: [{
|
11
|
-
title: "Free money for all!",
|
12
|
-
condition: ["and", true],
|
13
|
-
effects: [
|
14
|
-
["setDiscount", "Free money", 45.55]
|
15
|
-
]
|
16
|
-
}]
|
17
|
-
|
18
|
-
management_client.update_campaign_status @app["id"], @campaign["id"], "enabled"
|
19
|
-
|
20
|
-
@event_type ||= "Viewed Page#{rand(36**3).to_s(36)}"
|
21
|
-
@attribute ||= management_client.create_attribute({ entity: "Event", eventType: @event_type, name: "URL", title: "Page URL", type: "string", description: "The URL of the page that the user has viewed", tags: [], editable: true })
|
22
|
-
end
|
23
|
-
|
24
|
-
def teardown
|
25
|
-
management_client.delete_application @app["id"]
|
26
|
-
management_client.delete_attribute @attribute["id"]
|
27
|
-
end
|
28
|
-
|
29
|
-
def integration_config
|
30
|
-
{ application_id: @app["id"], application_key: @app["key"] }
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_track_event
|
34
|
-
res = integration_client.track_event "a-session", @event_type, { URL: "http://example.com" }
|
35
|
-
assert res.profile
|
36
|
-
assert res.session
|
37
|
-
assert_instance_of TalonOne::Integration::Event, res.event
|
38
|
-
assert !res.event.rejected_coupon?, "No coupon -> no rejectCoupon effect"
|
39
|
-
assert !res.event.accepted_coupon?, "No coupon -> no acceptCoupon effect"
|
40
|
-
assert_equal 1, res.event.effects.length
|
41
|
-
assert_equal "setDiscount", res.event.effects[0].function
|
42
|
-
assert_equal @event_type, res.event.type
|
43
|
-
assert_equal "a-session", res.event.session_id, "a-session"
|
44
|
-
assert_equal({ "URL" => "http://example.com" }, res.event.attributes)
|
45
|
-
assert_instance_of BigDecimal, res.session["discounts"]["Free money"]
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_update_customer_session
|
49
|
-
res = integration_client.update_customer_session "new-session", {
|
50
|
-
coupon: "invalid coupon code",
|
51
|
-
total: BigDecimal.new("45.55"),
|
52
|
-
}
|
53
|
-
assert res.event.rejected_coupon?, "invalid coupon code was rejected"
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_raise_error
|
57
|
-
err = assert_raises TalonOne::Integration::ClientError do
|
58
|
-
integration_client.track_event "a-session", @event_type, { BADURL: "http://example.com" }
|
59
|
-
end
|
60
|
-
|
61
|
-
assert_includes err.message, '400'
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|