ifeelgoods 0.0.1
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 +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +81 -0
- data/README.md +167 -0
- data/Rakefile +10 -0
- data/docs/Account.md +34 -0
- data/docs/AccountsApi.md +84 -0
- data/docs/ActivateRedemptionRequest.md +18 -0
- data/docs/ActivateRedemptionRequestData.md +18 -0
- data/docs/Address.md +32 -0
- data/docs/BrandSummary.md +24 -0
- data/docs/BudgetLineItem.md +30 -0
- data/docs/CardConsultRedemption200Response.md +18 -0
- data/docs/CardConsultRedemption200ResponseData.md +20 -0
- data/docs/CardConsultRedemption422Response.md +20 -0
- data/docs/ClientDetails.md +40 -0
- data/docs/ClientSummary.md +40 -0
- data/docs/ClientSummaryBudgetAlerts.md +20 -0
- data/docs/ClientsApi.md +341 -0
- data/docs/CreateAndRedeemRequest.md +18 -0
- data/docs/CreateAndRedeemRequestData.md +24 -0
- data/docs/CreateRedemption201Response.md +18 -0
- data/docs/CreateRedemption422Response.md +20 -0
- data/docs/CreateRedemptionRequest.md +18 -0
- data/docs/CreateRedemptionRequestData.md +26 -0
- data/docs/CreateRedemptionRequestDataCustomization.md +18 -0
- data/docs/CreateRedemptionRequestDataCustomizationPdf.md +20 -0
- data/docs/CreateRedemptionRequestDataReward.md +18 -0
- data/docs/CreateRedemptionRequestDataValue.md +18 -0
- data/docs/Dimension.md +44 -0
- data/docs/DimensionDenomination.md +49 -0
- data/docs/DiscountSummary.md +28 -0
- data/docs/ErrorResponse.md +20 -0
- data/docs/GetClientBudgetHistory200Response.md +20 -0
- data/docs/GetClientById200Response.md +18 -0
- data/docs/GetCurrentAccount200Response.md +18 -0
- data/docs/GetPromotionByID200Response.md +18 -0
- data/docs/GetPromotionByID401Response.md +20 -0
- data/docs/GetPromotionByID404Response.md +20 -0
- data/docs/GetRedemptionStats200Response.md +20 -0
- data/docs/GetRewardBySKU200Response.md +18 -0
- data/docs/ListClientDiscounts200Response.md +20 -0
- data/docs/ListClientPromotions200Response.md +20 -0
- data/docs/ListClientPromotions200ResponsePaging.md +22 -0
- data/docs/ListClientPromotions401Response.md +20 -0
- data/docs/ListClientVendorPlaces200Response.md +20 -0
- data/docs/ListClients200Response.md +20 -0
- data/docs/ListRedemptions200Response.md +20 -0
- data/docs/ListRewards200Response.md +20 -0
- data/docs/ProductSummary.md +26 -0
- data/docs/ProductType.md +20 -0
- data/docs/PromotionDetails.md +46 -0
- data/docs/PromotionDetailsClient.md +20 -0
- data/docs/PromotionDetailsRewardsInner.md +28 -0
- data/docs/PromotionsApi.md +173 -0
- data/docs/Redemption.md +58 -0
- data/docs/RedemptionPromotion.md +24 -0
- data/docs/RedemptionReward.md +24 -0
- data/docs/RedemptionRewardFormat.md +20 -0
- data/docs/RedemptionValue.md +20 -0
- data/docs/RedemptionsApi.md +857 -0
- data/docs/RewardDetails.md +76 -0
- data/docs/RewardDetailsBrand.md +24 -0
- data/docs/RewardDetailsDimensions.md +44 -0
- data/docs/RewardDetailsProduct.md +26 -0
- data/docs/RewardDetailsProductType.md +20 -0
- data/docs/RewardDetailsTargeting.md +22 -0
- data/docs/RewardFormat.md +20 -0
- data/docs/RewardsApi.md +175 -0
- data/docs/Stats.md +20 -0
- data/docs/StatsApi.md +101 -0
- data/docs/StatsTimeframe.md +20 -0
- data/docs/StatsValuesInner.md +24 -0
- data/docs/StatsValuesInnerGroupByInner.md +26 -0
- data/docs/StatsValuesInnerStates.md +34 -0
- data/docs/User.md +26 -0
- data/docs/VendorPlace.md +26 -0
- data/docs/VendorPlaceBrand.md +20 -0
- data/docs/VendorPlaceGeoloc.md +20 -0
- data/docs/VendorPlacesApi.md +97 -0
- data/git_push.sh +57 -0
- data/ifeelgoods.gemspec +39 -0
- data/lib/ifeelgoods/api/accounts_api.rb +79 -0
- data/lib/ifeelgoods/api/clients_api.rb +318 -0
- data/lib/ifeelgoods/api/promotions_api.rb +166 -0
- data/lib/ifeelgoods/api/redemptions_api.rb +762 -0
- data/lib/ifeelgoods/api/rewards_api.rb +166 -0
- data/lib/ifeelgoods/api/stats_api.rb +111 -0
- data/lib/ifeelgoods/api/vendor_places_api.rb +109 -0
- data/lib/ifeelgoods/api_client.rb +397 -0
- data/lib/ifeelgoods/api_error.rb +58 -0
- data/lib/ifeelgoods/api_model_base.rb +88 -0
- data/lib/ifeelgoods/configuration.rb +332 -0
- data/lib/ifeelgoods/models/account.rb +260 -0
- data/lib/ifeelgoods/models/activate_redemption_request.rb +164 -0
- data/lib/ifeelgoods/models/activate_redemption_request_data.rb +147 -0
- data/lib/ifeelgoods/models/address.rb +219 -0
- data/lib/ifeelgoods/models/brand_summary.rb +212 -0
- data/lib/ifeelgoods/models/budget_line_item.rb +249 -0
- data/lib/ifeelgoods/models/card_consult_redemption200_response.rb +147 -0
- data/lib/ifeelgoods/models/card_consult_redemption200_response_data.rb +158 -0
- data/lib/ifeelgoods/models/card_consult_redemption422_response.rb +157 -0
- data/lib/ifeelgoods/models/client_details.rb +287 -0
- data/lib/ifeelgoods/models/client_summary.rb +287 -0
- data/lib/ifeelgoods/models/client_summary_budget_alerts.rb +159 -0
- data/lib/ifeelgoods/models/create_and_redeem_request.rb +164 -0
- data/lib/ifeelgoods/models/create_and_redeem_request_data.rb +174 -0
- data/lib/ifeelgoods/models/create_redemption201_response.rb +147 -0
- data/lib/ifeelgoods/models/create_redemption422_response.rb +157 -0
- data/lib/ifeelgoods/models/create_redemption_request.rb +164 -0
- data/lib/ifeelgoods/models/create_redemption_request_data.rb +235 -0
- data/lib/ifeelgoods/models/create_redemption_request_data_customization.rb +147 -0
- data/lib/ifeelgoods/models/create_redemption_request_data_customization_pdf.rb +157 -0
- data/lib/ifeelgoods/models/create_redemption_request_data_reward.rb +147 -0
- data/lib/ifeelgoods/models/create_redemption_request_data_value.rb +148 -0
- data/lib/ifeelgoods/models/dimension.rb +293 -0
- data/lib/ifeelgoods/models/dimension_denomination.rb +105 -0
- data/lib/ifeelgoods/models/discount_summary.rb +195 -0
- data/lib/ifeelgoods/models/error_response.rb +157 -0
- data/lib/ifeelgoods/models/get_client_budget_history200_response.rb +158 -0
- data/lib/ifeelgoods/models/get_client_by_id200_response.rb +147 -0
- data/lib/ifeelgoods/models/get_current_account200_response.rb +147 -0
- data/lib/ifeelgoods/models/get_promotion_by_id200_response.rb +147 -0
- data/lib/ifeelgoods/models/get_promotion_by_id401_response.rb +157 -0
- data/lib/ifeelgoods/models/get_promotion_by_id404_response.rb +157 -0
- data/lib/ifeelgoods/models/get_redemption_stats200_response.rb +158 -0
- data/lib/ifeelgoods/models/get_reward_by_sku200_response.rb +147 -0
- data/lib/ifeelgoods/models/list_client_discounts200_response.rb +158 -0
- data/lib/ifeelgoods/models/list_client_promotions200_response.rb +158 -0
- data/lib/ifeelgoods/models/list_client_promotions200_response_paging.rb +165 -0
- data/lib/ifeelgoods/models/list_client_promotions401_response.rb +157 -0
- data/lib/ifeelgoods/models/list_client_vendor_places200_response.rb +158 -0
- data/lib/ifeelgoods/models/list_clients200_response.rb +158 -0
- data/lib/ifeelgoods/models/list_redemptions200_response.rb +158 -0
- data/lib/ifeelgoods/models/list_rewards200_response.rb +158 -0
- data/lib/ifeelgoods/models/product_summary.rb +222 -0
- data/lib/ifeelgoods/models/product_type.rb +204 -0
- data/lib/ifeelgoods/models/promotion_details.rb +354 -0
- data/lib/ifeelgoods/models/promotion_details_client.rb +157 -0
- data/lib/ifeelgoods/models/promotion_details_rewards_inner.rb +245 -0
- data/lib/ifeelgoods/models/redemption.rb +383 -0
- data/lib/ifeelgoods/models/redemption_promotion.rb +211 -0
- data/lib/ifeelgoods/models/redemption_reward.rb +224 -0
- data/lib/ifeelgoods/models/redemption_reward_format.rb +193 -0
- data/lib/ifeelgoods/models/redemption_value.rb +157 -0
- data/lib/ifeelgoods/models/reward_details.rb +486 -0
- data/lib/ifeelgoods/models/reward_details_brand.rb +213 -0
- data/lib/ifeelgoods/models/reward_details_dimensions.rb +293 -0
- data/lib/ifeelgoods/models/reward_details_product.rb +222 -0
- data/lib/ifeelgoods/models/reward_details_product_type.rb +204 -0
- data/lib/ifeelgoods/models/reward_details_targeting.rb +170 -0
- data/lib/ifeelgoods/models/reward_format.rb +192 -0
- data/lib/ifeelgoods/models/stats.rb +158 -0
- data/lib/ifeelgoods/models/stats_timeframe.rb +156 -0
- data/lib/ifeelgoods/models/stats_values_inner.rb +178 -0
- data/lib/ifeelgoods/models/stats_values_inner_group_by_inner.rb +186 -0
- data/lib/ifeelgoods/models/stats_values_inner_states.rb +219 -0
- data/lib/ifeelgoods/models/user.rb +188 -0
- data/lib/ifeelgoods/models/vendor_place.rb +186 -0
- data/lib/ifeelgoods/models/vendor_place_brand.rb +158 -0
- data/lib/ifeelgoods/models/vendor_place_geoloc.rb +156 -0
- data/lib/ifeelgoods/version.rb +15 -0
- data/lib/ifeelgoods.rb +115 -0
- data/spec/api/accounts_api_spec.rb +46 -0
- data/spec/api/clients_api_spec.rb +88 -0
- data/spec/api/promotions_api_spec.rb +61 -0
- data/spec/api/redemptions_api_spec.rb +175 -0
- data/spec/api/rewards_api_spec.rb +62 -0
- data/spec/api/stats_api_spec.rb +53 -0
- data/spec/api/vendor_places_api_spec.rb +51 -0
- data/spec/models/account_spec.rb +88 -0
- data/spec/models/activate_redemption_request_data_spec.rb +36 -0
- data/spec/models/activate_redemption_request_spec.rb +36 -0
- data/spec/models/address_spec.rb +78 -0
- data/spec/models/brand_summary_spec.rb +58 -0
- data/spec/models/budget_line_item_spec.rb +80 -0
- data/spec/models/card_consult_redemption200_response_data_spec.rb +42 -0
- data/spec/models/card_consult_redemption200_response_spec.rb +36 -0
- data/spec/models/card_consult_redemption422_response_spec.rb +42 -0
- data/spec/models/client_details_spec.rb +106 -0
- data/spec/models/client_summary_budget_alerts_spec.rb +42 -0
- data/spec/models/client_summary_spec.rb +106 -0
- data/spec/models/create_and_redeem_request_data_spec.rb +54 -0
- data/spec/models/create_and_redeem_request_spec.rb +36 -0
- data/spec/models/create_redemption201_response_spec.rb +36 -0
- data/spec/models/create_redemption422_response_spec.rb +42 -0
- data/spec/models/create_redemption_request_data_customization_pdf_spec.rb +42 -0
- data/spec/models/create_redemption_request_data_customization_spec.rb +36 -0
- data/spec/models/create_redemption_request_data_reward_spec.rb +36 -0
- data/spec/models/create_redemption_request_data_spec.rb +60 -0
- data/spec/models/create_redemption_request_data_value_spec.rb +36 -0
- data/spec/models/create_redemption_request_spec.rb +36 -0
- data/spec/models/dimension_denomination_spec.rb +32 -0
- data/spec/models/dimension_spec.rb +114 -0
- data/spec/models/discount_summary_spec.rb +66 -0
- data/spec/models/error_response_spec.rb +42 -0
- data/spec/models/get_client_budget_history200_response_spec.rb +42 -0
- data/spec/models/get_client_by_id200_response_spec.rb +36 -0
- data/spec/models/get_current_account200_response_spec.rb +36 -0
- data/spec/models/get_promotion_by_id200_response_spec.rb +36 -0
- data/spec/models/get_promotion_by_id401_response_spec.rb +42 -0
- data/spec/models/get_promotion_by_id404_response_spec.rb +42 -0
- data/spec/models/get_redemption_stats200_response_spec.rb +42 -0
- data/spec/models/get_reward_by_sku200_response_spec.rb +36 -0
- data/spec/models/list_client_discounts200_response_spec.rb +42 -0
- data/spec/models/list_client_promotions200_response_paging_spec.rb +48 -0
- data/spec/models/list_client_promotions200_response_spec.rb +42 -0
- data/spec/models/list_client_promotions401_response_spec.rb +42 -0
- data/spec/models/list_client_vendor_places200_response_spec.rb +42 -0
- data/spec/models/list_clients200_response_spec.rb +42 -0
- data/spec/models/list_redemptions200_response_spec.rb +42 -0
- data/spec/models/list_rewards200_response_spec.rb +42 -0
- data/spec/models/product_summary_spec.rb +64 -0
- data/spec/models/product_type_spec.rb +50 -0
- data/spec/models/promotion_details_client_spec.rb +42 -0
- data/spec/models/promotion_details_rewards_inner_spec.rb +78 -0
- data/spec/models/promotion_details_spec.rb +136 -0
- data/spec/models/redemption_promotion_spec.rb +58 -0
- data/spec/models/redemption_reward_format_spec.rb +50 -0
- data/spec/models/redemption_reward_spec.rb +62 -0
- data/spec/models/redemption_spec.rb +168 -0
- data/spec/models/redemption_value_spec.rb +42 -0
- data/spec/models/reward_details_brand_spec.rb +58 -0
- data/spec/models/reward_details_dimensions_spec.rb +114 -0
- data/spec/models/reward_details_product_spec.rb +64 -0
- data/spec/models/reward_details_product_type_spec.rb +50 -0
- data/spec/models/reward_details_spec.rb +218 -0
- data/spec/models/reward_details_targeting_spec.rb +48 -0
- data/spec/models/reward_format_spec.rb +50 -0
- data/spec/models/stats_spec.rb +42 -0
- data/spec/models/stats_timeframe_spec.rb +42 -0
- data/spec/models/stats_values_inner_group_by_inner_spec.rb +60 -0
- data/spec/models/stats_values_inner_spec.rb +54 -0
- data/spec/models/stats_values_inner_states_spec.rb +84 -0
- data/spec/models/user_spec.rb +60 -0
- data/spec/models/vendor_place_brand_spec.rb +42 -0
- data/spec/models/vendor_place_geoloc_spec.rb +42 -0
- data/spec/models/vendor_place_spec.rb +60 -0
- data/spec/spec_helper.rb +111 -0
- metadata +397 -0
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fulfillment API
|
|
3
|
+
|
|
4
|
+
#Public API exposed to ifeelgoods customers.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v2
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.24.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Ifeelgoods
|
|
16
|
+
class RedemptionsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Activate
|
|
23
|
+
# Use this function to perform an activation from an existing redemption object and retrieve a authenticated link (url key).
|
|
24
|
+
# @param redemption_id [String] Unique Redemption identifier (eg. ZN7RS-9RNLY)
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [ActivateRedemptionRequest] :activate_redemption_request
|
|
27
|
+
# @return [CreateRedemption201Response]
|
|
28
|
+
def activate_redemption(redemption_id, opts = {})
|
|
29
|
+
data, _status_code, _headers = activate_redemption_with_http_info(redemption_id, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Activate
|
|
34
|
+
# Use this function to perform an activation from an existing redemption object and retrieve a authenticated link (url key).
|
|
35
|
+
# @param redemption_id [String] Unique Redemption identifier (eg. ZN7RS-9RNLY)
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [ActivateRedemptionRequest] :activate_redemption_request
|
|
38
|
+
# @return [Array<(CreateRedemption201Response, Integer, Hash)>] CreateRedemption201Response data, response status code and response headers
|
|
39
|
+
def activate_redemption_with_http_info(redemption_id, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.activate_redemption ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'redemption_id' is set
|
|
44
|
+
if @api_client.config.client_side_validation && redemption_id.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'redemption_id' when calling RedemptionsApi.activate_redemption"
|
|
46
|
+
end
|
|
47
|
+
# resource path
|
|
48
|
+
local_var_path = '/fulfillment/v2/redemptions/{redemption_id}/actions/activate'.sub('{redemption_id}', CGI.escape(redemption_id.to_s))
|
|
49
|
+
|
|
50
|
+
# query parameters
|
|
51
|
+
query_params = opts[:query_params] || {}
|
|
52
|
+
|
|
53
|
+
# header parameters
|
|
54
|
+
header_params = opts[:header_params] || {}
|
|
55
|
+
# HTTP header 'Accept' (if needed)
|
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/pdf']) unless header_params['Accept']
|
|
57
|
+
# HTTP header 'Content-Type'
|
|
58
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
59
|
+
if !content_type.nil?
|
|
60
|
+
header_params['Content-Type'] = content_type
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# form parameters
|
|
64
|
+
form_params = opts[:form_params] || {}
|
|
65
|
+
|
|
66
|
+
# http body (model)
|
|
67
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'activate_redemption_request'])
|
|
68
|
+
|
|
69
|
+
# return_type
|
|
70
|
+
return_type = opts[:debug_return_type] || 'CreateRedemption201Response'
|
|
71
|
+
|
|
72
|
+
# auth_names
|
|
73
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
74
|
+
|
|
75
|
+
new_options = opts.merge(
|
|
76
|
+
:operation => :"RedemptionsApi.activate_redemption",
|
|
77
|
+
:header_params => header_params,
|
|
78
|
+
:query_params => query_params,
|
|
79
|
+
:form_params => form_params,
|
|
80
|
+
:body => post_body,
|
|
81
|
+
:auth_names => auth_names,
|
|
82
|
+
:return_type => return_type
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
86
|
+
if @api_client.config.debugging
|
|
87
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#activate_redemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
88
|
+
end
|
|
89
|
+
return data, status_code, headers
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Book
|
|
93
|
+
# Use this function to book a reward code before redeem it. This action will do the same as in Create a Redemption API but will also book a reward code for a duration of 30 minutes. You can then redeem the redemption using Create and Redeem or Redeem APIs using the same parameters (eg. same order_id and user email).
|
|
94
|
+
# @param promotion_id [String] The promotion identifier
|
|
95
|
+
# @param reward_sku [String] The reward SKU
|
|
96
|
+
# @param [Hash] opts the optional parameters
|
|
97
|
+
# @option opts [CreateAndRedeemRequest] :create_and_redeem_request
|
|
98
|
+
# @return [CreateRedemption201Response]
|
|
99
|
+
def book_redemption(promotion_id, reward_sku, opts = {})
|
|
100
|
+
data, _status_code, _headers = book_redemption_with_http_info(promotion_id, reward_sku, opts)
|
|
101
|
+
data
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Book
|
|
105
|
+
# Use this function to book a reward code before redeem it. This action will do the same as in Create a Redemption API but will also book a reward code for a duration of 30 minutes. You can then redeem the redemption using Create and Redeem or Redeem APIs using the same parameters (eg. same order_id and user email).
|
|
106
|
+
# @param promotion_id [String] The promotion identifier
|
|
107
|
+
# @param reward_sku [String] The reward SKU
|
|
108
|
+
# @param [Hash] opts the optional parameters
|
|
109
|
+
# @option opts [CreateAndRedeemRequest] :create_and_redeem_request
|
|
110
|
+
# @return [Array<(CreateRedemption201Response, Integer, Hash)>] CreateRedemption201Response data, response status code and response headers
|
|
111
|
+
def book_redemption_with_http_info(promotion_id, reward_sku, opts = {})
|
|
112
|
+
if @api_client.config.debugging
|
|
113
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.book_redemption ...'
|
|
114
|
+
end
|
|
115
|
+
# verify the required parameter 'promotion_id' is set
|
|
116
|
+
if @api_client.config.client_side_validation && promotion_id.nil?
|
|
117
|
+
fail ArgumentError, "Missing the required parameter 'promotion_id' when calling RedemptionsApi.book_redemption"
|
|
118
|
+
end
|
|
119
|
+
# verify the required parameter 'reward_sku' is set
|
|
120
|
+
if @api_client.config.client_side_validation && reward_sku.nil?
|
|
121
|
+
fail ArgumentError, "Missing the required parameter 'reward_sku' when calling RedemptionsApi.book_redemption"
|
|
122
|
+
end
|
|
123
|
+
# resource path
|
|
124
|
+
local_var_path = '/fulfillment/v2/promotions/{promotion_id}/rewards/{reward_sku}/redemptions/book'.sub('{promotion_id}', CGI.escape(promotion_id.to_s)).sub('{reward_sku}', CGI.escape(reward_sku.to_s))
|
|
125
|
+
|
|
126
|
+
# query parameters
|
|
127
|
+
query_params = opts[:query_params] || {}
|
|
128
|
+
|
|
129
|
+
# header parameters
|
|
130
|
+
header_params = opts[:header_params] || {}
|
|
131
|
+
# HTTP header 'Accept' (if needed)
|
|
132
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
133
|
+
# HTTP header 'Content-Type'
|
|
134
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
135
|
+
if !content_type.nil?
|
|
136
|
+
header_params['Content-Type'] = content_type
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# form parameters
|
|
140
|
+
form_params = opts[:form_params] || {}
|
|
141
|
+
|
|
142
|
+
# http body (model)
|
|
143
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_and_redeem_request'])
|
|
144
|
+
|
|
145
|
+
# return_type
|
|
146
|
+
return_type = opts[:debug_return_type] || 'CreateRedemption201Response'
|
|
147
|
+
|
|
148
|
+
# auth_names
|
|
149
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
150
|
+
|
|
151
|
+
new_options = opts.merge(
|
|
152
|
+
:operation => :"RedemptionsApi.book_redemption",
|
|
153
|
+
:header_params => header_params,
|
|
154
|
+
:query_params => query_params,
|
|
155
|
+
:form_params => form_params,
|
|
156
|
+
:body => post_body,
|
|
157
|
+
:auth_names => auth_names,
|
|
158
|
+
:return_type => return_type
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
162
|
+
if @api_client.config.debugging
|
|
163
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#book_redemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
164
|
+
end
|
|
165
|
+
return data, status_code, headers
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Cancel
|
|
169
|
+
# Use this function to cancel a pending/failed redemption.
|
|
170
|
+
# @param redemption_id [String] The redemption identifier
|
|
171
|
+
# @param [Hash] opts the optional parameters
|
|
172
|
+
# @return [CreateRedemption201Response]
|
|
173
|
+
def cancel_redemption(redemption_id, opts = {})
|
|
174
|
+
data, _status_code, _headers = cancel_redemption_with_http_info(redemption_id, opts)
|
|
175
|
+
data
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Cancel
|
|
179
|
+
# Use this function to cancel a pending/failed redemption.
|
|
180
|
+
# @param redemption_id [String] The redemption identifier
|
|
181
|
+
# @param [Hash] opts the optional parameters
|
|
182
|
+
# @return [Array<(CreateRedemption201Response, Integer, Hash)>] CreateRedemption201Response data, response status code and response headers
|
|
183
|
+
def cancel_redemption_with_http_info(redemption_id, opts = {})
|
|
184
|
+
if @api_client.config.debugging
|
|
185
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.cancel_redemption ...'
|
|
186
|
+
end
|
|
187
|
+
# verify the required parameter 'redemption_id' is set
|
|
188
|
+
if @api_client.config.client_side_validation && redemption_id.nil?
|
|
189
|
+
fail ArgumentError, "Missing the required parameter 'redemption_id' when calling RedemptionsApi.cancel_redemption"
|
|
190
|
+
end
|
|
191
|
+
# resource path
|
|
192
|
+
local_var_path = '/fulfillment/v2/redemptions/{redemption_id}/actions/cancel'.sub('{redemption_id}', CGI.escape(redemption_id.to_s))
|
|
193
|
+
|
|
194
|
+
# query parameters
|
|
195
|
+
query_params = opts[:query_params] || {}
|
|
196
|
+
|
|
197
|
+
# header parameters
|
|
198
|
+
header_params = opts[:header_params] || {}
|
|
199
|
+
# HTTP header 'Accept' (if needed)
|
|
200
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
201
|
+
|
|
202
|
+
# form parameters
|
|
203
|
+
form_params = opts[:form_params] || {}
|
|
204
|
+
|
|
205
|
+
# http body (model)
|
|
206
|
+
post_body = opts[:debug_body]
|
|
207
|
+
|
|
208
|
+
# return_type
|
|
209
|
+
return_type = opts[:debug_return_type] || 'CreateRedemption201Response'
|
|
210
|
+
|
|
211
|
+
# auth_names
|
|
212
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
213
|
+
|
|
214
|
+
new_options = opts.merge(
|
|
215
|
+
:operation => :"RedemptionsApi.cancel_redemption",
|
|
216
|
+
:header_params => header_params,
|
|
217
|
+
:query_params => query_params,
|
|
218
|
+
:form_params => form_params,
|
|
219
|
+
:body => post_body,
|
|
220
|
+
:auth_names => auth_names,
|
|
221
|
+
:return_type => return_type
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
225
|
+
if @api_client.config.debugging
|
|
226
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#cancel_redemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
227
|
+
end
|
|
228
|
+
return data, status_code, headers
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Consult Card
|
|
232
|
+
# Use this function to retrieve card information (balance, currency) for a redemption when supported by the reward provider.
|
|
233
|
+
# @param redemption_id [String] The redemption identifier
|
|
234
|
+
# @param [Hash] opts the optional parameters
|
|
235
|
+
# @return [CardConsultRedemption200Response]
|
|
236
|
+
def card_consult_redemption(redemption_id, opts = {})
|
|
237
|
+
data, _status_code, _headers = card_consult_redemption_with_http_info(redemption_id, opts)
|
|
238
|
+
data
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Consult Card
|
|
242
|
+
# Use this function to retrieve card information (balance, currency) for a redemption when supported by the reward provider.
|
|
243
|
+
# @param redemption_id [String] The redemption identifier
|
|
244
|
+
# @param [Hash] opts the optional parameters
|
|
245
|
+
# @return [Array<(CardConsultRedemption200Response, Integer, Hash)>] CardConsultRedemption200Response data, response status code and response headers
|
|
246
|
+
def card_consult_redemption_with_http_info(redemption_id, opts = {})
|
|
247
|
+
if @api_client.config.debugging
|
|
248
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.card_consult_redemption ...'
|
|
249
|
+
end
|
|
250
|
+
# verify the required parameter 'redemption_id' is set
|
|
251
|
+
if @api_client.config.client_side_validation && redemption_id.nil?
|
|
252
|
+
fail ArgumentError, "Missing the required parameter 'redemption_id' when calling RedemptionsApi.card_consult_redemption"
|
|
253
|
+
end
|
|
254
|
+
# resource path
|
|
255
|
+
local_var_path = '/fulfillment/v2/redemptions/{redemption_id}/card_consult'.sub('{redemption_id}', CGI.escape(redemption_id.to_s))
|
|
256
|
+
|
|
257
|
+
# query parameters
|
|
258
|
+
query_params = opts[:query_params] || {}
|
|
259
|
+
|
|
260
|
+
# header parameters
|
|
261
|
+
header_params = opts[:header_params] || {}
|
|
262
|
+
# HTTP header 'Accept' (if needed)
|
|
263
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
264
|
+
|
|
265
|
+
# form parameters
|
|
266
|
+
form_params = opts[:form_params] || {}
|
|
267
|
+
|
|
268
|
+
# http body (model)
|
|
269
|
+
post_body = opts[:debug_body]
|
|
270
|
+
|
|
271
|
+
# return_type
|
|
272
|
+
return_type = opts[:debug_return_type] || 'CardConsultRedemption200Response'
|
|
273
|
+
|
|
274
|
+
# auth_names
|
|
275
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
276
|
+
|
|
277
|
+
new_options = opts.merge(
|
|
278
|
+
:operation => :"RedemptionsApi.card_consult_redemption",
|
|
279
|
+
:header_params => header_params,
|
|
280
|
+
:query_params => query_params,
|
|
281
|
+
:form_params => form_params,
|
|
282
|
+
:body => post_body,
|
|
283
|
+
:auth_names => auth_names,
|
|
284
|
+
:return_type => return_type
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
288
|
+
if @api_client.config.debugging
|
|
289
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#card_consult_redemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
290
|
+
end
|
|
291
|
+
return data, status_code, headers
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Create and Redeem
|
|
295
|
+
# Use this function to create a redemption object and perform a reward delivery. Calling this endpoint on an existing order_id with the exact same parameters will return the existing order.
|
|
296
|
+
# @param promotion_id [String] The promotion identifier
|
|
297
|
+
# @param reward_sku [String] The reward SKU
|
|
298
|
+
# @param [Hash] opts the optional parameters
|
|
299
|
+
# @option opts [CreateAndRedeemRequest] :create_and_redeem_request
|
|
300
|
+
# @return [CreateRedemption201Response]
|
|
301
|
+
def create_and_redeem(promotion_id, reward_sku, opts = {})
|
|
302
|
+
data, _status_code, _headers = create_and_redeem_with_http_info(promotion_id, reward_sku, opts)
|
|
303
|
+
data
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Create and Redeem
|
|
307
|
+
# Use this function to create a redemption object and perform a reward delivery. Calling this endpoint on an existing order_id with the exact same parameters will return the existing order.
|
|
308
|
+
# @param promotion_id [String] The promotion identifier
|
|
309
|
+
# @param reward_sku [String] The reward SKU
|
|
310
|
+
# @param [Hash] opts the optional parameters
|
|
311
|
+
# @option opts [CreateAndRedeemRequest] :create_and_redeem_request
|
|
312
|
+
# @return [Array<(CreateRedemption201Response, Integer, Hash)>] CreateRedemption201Response data, response status code and response headers
|
|
313
|
+
def create_and_redeem_with_http_info(promotion_id, reward_sku, opts = {})
|
|
314
|
+
if @api_client.config.debugging
|
|
315
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.create_and_redeem ...'
|
|
316
|
+
end
|
|
317
|
+
# verify the required parameter 'promotion_id' is set
|
|
318
|
+
if @api_client.config.client_side_validation && promotion_id.nil?
|
|
319
|
+
fail ArgumentError, "Missing the required parameter 'promotion_id' when calling RedemptionsApi.create_and_redeem"
|
|
320
|
+
end
|
|
321
|
+
# verify the required parameter 'reward_sku' is set
|
|
322
|
+
if @api_client.config.client_side_validation && reward_sku.nil?
|
|
323
|
+
fail ArgumentError, "Missing the required parameter 'reward_sku' when calling RedemptionsApi.create_and_redeem"
|
|
324
|
+
end
|
|
325
|
+
# resource path
|
|
326
|
+
local_var_path = '/fulfillment/v2/promotions/{promotion_id}/rewards/{reward_sku}/redemptions/redeem'.sub('{promotion_id}', CGI.escape(promotion_id.to_s)).sub('{reward_sku}', CGI.escape(reward_sku.to_s))
|
|
327
|
+
|
|
328
|
+
# query parameters
|
|
329
|
+
query_params = opts[:query_params] || {}
|
|
330
|
+
|
|
331
|
+
# header parameters
|
|
332
|
+
header_params = opts[:header_params] || {}
|
|
333
|
+
# HTTP header 'Accept' (if needed)
|
|
334
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/pdf']) unless header_params['Accept']
|
|
335
|
+
# HTTP header 'Content-Type'
|
|
336
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
337
|
+
if !content_type.nil?
|
|
338
|
+
header_params['Content-Type'] = content_type
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
# form parameters
|
|
342
|
+
form_params = opts[:form_params] || {}
|
|
343
|
+
|
|
344
|
+
# http body (model)
|
|
345
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_and_redeem_request'])
|
|
346
|
+
|
|
347
|
+
# return_type
|
|
348
|
+
return_type = opts[:debug_return_type] || 'CreateRedemption201Response'
|
|
349
|
+
|
|
350
|
+
# auth_names
|
|
351
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
352
|
+
|
|
353
|
+
new_options = opts.merge(
|
|
354
|
+
:operation => :"RedemptionsApi.create_and_redeem",
|
|
355
|
+
:header_params => header_params,
|
|
356
|
+
:query_params => query_params,
|
|
357
|
+
:form_params => form_params,
|
|
358
|
+
:body => post_body,
|
|
359
|
+
:auth_names => auth_names,
|
|
360
|
+
:return_type => return_type
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
364
|
+
if @api_client.config.debugging
|
|
365
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#create_and_redeem\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
366
|
+
end
|
|
367
|
+
return data, status_code, headers
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
# Create a redemption
|
|
371
|
+
# Use this function to create a redemption object and initiate a reward delivery.
|
|
372
|
+
# @param promotion_id [String] The promotion identifier
|
|
373
|
+
# @param create_redemption_request [CreateRedemptionRequest]
|
|
374
|
+
# @param [Hash] opts the optional parameters
|
|
375
|
+
# @return [CreateRedemption201Response]
|
|
376
|
+
def create_redemption(promotion_id, create_redemption_request, opts = {})
|
|
377
|
+
data, _status_code, _headers = create_redemption_with_http_info(promotion_id, create_redemption_request, opts)
|
|
378
|
+
data
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
# Create a redemption
|
|
382
|
+
# Use this function to create a redemption object and initiate a reward delivery.
|
|
383
|
+
# @param promotion_id [String] The promotion identifier
|
|
384
|
+
# @param create_redemption_request [CreateRedemptionRequest]
|
|
385
|
+
# @param [Hash] opts the optional parameters
|
|
386
|
+
# @return [Array<(CreateRedemption201Response, Integer, Hash)>] CreateRedemption201Response data, response status code and response headers
|
|
387
|
+
def create_redemption_with_http_info(promotion_id, create_redemption_request, opts = {})
|
|
388
|
+
if @api_client.config.debugging
|
|
389
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.create_redemption ...'
|
|
390
|
+
end
|
|
391
|
+
# verify the required parameter 'promotion_id' is set
|
|
392
|
+
if @api_client.config.client_side_validation && promotion_id.nil?
|
|
393
|
+
fail ArgumentError, "Missing the required parameter 'promotion_id' when calling RedemptionsApi.create_redemption"
|
|
394
|
+
end
|
|
395
|
+
# verify the required parameter 'create_redemption_request' is set
|
|
396
|
+
if @api_client.config.client_side_validation && create_redemption_request.nil?
|
|
397
|
+
fail ArgumentError, "Missing the required parameter 'create_redemption_request' when calling RedemptionsApi.create_redemption"
|
|
398
|
+
end
|
|
399
|
+
# resource path
|
|
400
|
+
local_var_path = '/fulfillment/v2/promotions/{promotion_id}/redemptions'.sub('{promotion_id}', CGI.escape(promotion_id.to_s))
|
|
401
|
+
|
|
402
|
+
# query parameters
|
|
403
|
+
query_params = opts[:query_params] || {}
|
|
404
|
+
|
|
405
|
+
# header parameters
|
|
406
|
+
header_params = opts[:header_params] || {}
|
|
407
|
+
# HTTP header 'Accept' (if needed)
|
|
408
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/pdf']) unless header_params['Accept']
|
|
409
|
+
# HTTP header 'Content-Type'
|
|
410
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
411
|
+
if !content_type.nil?
|
|
412
|
+
header_params['Content-Type'] = content_type
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
# form parameters
|
|
416
|
+
form_params = opts[:form_params] || {}
|
|
417
|
+
|
|
418
|
+
# http body (model)
|
|
419
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_redemption_request)
|
|
420
|
+
|
|
421
|
+
# return_type
|
|
422
|
+
return_type = opts[:debug_return_type] || 'CreateRedemption201Response'
|
|
423
|
+
|
|
424
|
+
# auth_names
|
|
425
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
426
|
+
|
|
427
|
+
new_options = opts.merge(
|
|
428
|
+
:operation => :"RedemptionsApi.create_redemption",
|
|
429
|
+
:header_params => header_params,
|
|
430
|
+
:query_params => query_params,
|
|
431
|
+
:form_params => form_params,
|
|
432
|
+
:body => post_body,
|
|
433
|
+
:auth_names => auth_names,
|
|
434
|
+
:return_type => return_type
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
438
|
+
if @api_client.config.debugging
|
|
439
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#create_redemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
440
|
+
end
|
|
441
|
+
return data, status_code, headers
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
# Get a redemption
|
|
445
|
+
# Use this function to retrieve detailed information about a redemption object.
|
|
446
|
+
# @param redemption_id [String] The redemption identifier
|
|
447
|
+
# @param [Hash] opts the optional parameters
|
|
448
|
+
# @return [CreateRedemption201Response]
|
|
449
|
+
def get_redemption_by_id(redemption_id, opts = {})
|
|
450
|
+
data, _status_code, _headers = get_redemption_by_id_with_http_info(redemption_id, opts)
|
|
451
|
+
data
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
# Get a redemption
|
|
455
|
+
# Use this function to retrieve detailed information about a redemption object.
|
|
456
|
+
# @param redemption_id [String] The redemption identifier
|
|
457
|
+
# @param [Hash] opts the optional parameters
|
|
458
|
+
# @return [Array<(CreateRedemption201Response, Integer, Hash)>] CreateRedemption201Response data, response status code and response headers
|
|
459
|
+
def get_redemption_by_id_with_http_info(redemption_id, opts = {})
|
|
460
|
+
if @api_client.config.debugging
|
|
461
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.get_redemption_by_id ...'
|
|
462
|
+
end
|
|
463
|
+
# verify the required parameter 'redemption_id' is set
|
|
464
|
+
if @api_client.config.client_side_validation && redemption_id.nil?
|
|
465
|
+
fail ArgumentError, "Missing the required parameter 'redemption_id' when calling RedemptionsApi.get_redemption_by_id"
|
|
466
|
+
end
|
|
467
|
+
# resource path
|
|
468
|
+
local_var_path = '/fulfillment/v2/redemptions/{redemption_id}'.sub('{redemption_id}', CGI.escape(redemption_id.to_s))
|
|
469
|
+
|
|
470
|
+
# query parameters
|
|
471
|
+
query_params = opts[:query_params] || {}
|
|
472
|
+
|
|
473
|
+
# header parameters
|
|
474
|
+
header_params = opts[:header_params] || {}
|
|
475
|
+
# HTTP header 'Accept' (if needed)
|
|
476
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/pdf']) unless header_params['Accept']
|
|
477
|
+
|
|
478
|
+
# form parameters
|
|
479
|
+
form_params = opts[:form_params] || {}
|
|
480
|
+
|
|
481
|
+
# http body (model)
|
|
482
|
+
post_body = opts[:debug_body]
|
|
483
|
+
|
|
484
|
+
# return_type
|
|
485
|
+
return_type = opts[:debug_return_type] || 'CreateRedemption201Response'
|
|
486
|
+
|
|
487
|
+
# auth_names
|
|
488
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
489
|
+
|
|
490
|
+
new_options = opts.merge(
|
|
491
|
+
:operation => :"RedemptionsApi.get_redemption_by_id",
|
|
492
|
+
:header_params => header_params,
|
|
493
|
+
:query_params => query_params,
|
|
494
|
+
:form_params => form_params,
|
|
495
|
+
:body => post_body,
|
|
496
|
+
:auth_names => auth_names,
|
|
497
|
+
:return_type => return_type
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
501
|
+
if @api_client.config.debugging
|
|
502
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#get_redemption_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
503
|
+
end
|
|
504
|
+
return data, status_code, headers
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
# List all Redemptions
|
|
508
|
+
# Use this function to list the status of all redemptions created as part of a promotion.
|
|
509
|
+
# @param promotion_id [String] The promotion identifier
|
|
510
|
+
# @param [Hash] opts the optional parameters
|
|
511
|
+
# @option opts [String] :reward_sku
|
|
512
|
+
# @option opts [String] :email
|
|
513
|
+
# @option opts [String] :order_id
|
|
514
|
+
# @option opts [String] :state Redemption state filter (eg. `pending`, `redeemed`, `canceled`, etc.)
|
|
515
|
+
# @option opts [Time] :redeemed_datetime_start Filter redemptions redeemed on or after this datetime (ISO 8601 format, e.g. `2024-01-01T00:00:00Z`)
|
|
516
|
+
# @option opts [Time] :redeemed_datetime_end Filter redemptions redeemed on or before this datetime (ISO 8601 format, e.g. `2024-01-31T23:59:59Z`)
|
|
517
|
+
# @option opts [Time] :activation_datetime_start Filter redemptions activated on or after this datetime (ISO 8601 format, e.g. `2024-01-01T00:00:00Z`)
|
|
518
|
+
# @option opts [Time] :activation_datetime_end Filter redemptions activated on or before this datetime (ISO 8601 format, e.g. `2024-01-31T23:59:59Z`)
|
|
519
|
+
# @option opts [Time] :refund_datetime_start Filter redemptions refunded on or after this datetime (ISO 8601 format, e.g. `2024-01-01T00:00:00Z`)
|
|
520
|
+
# @option opts [Time] :refund_datetime_end Filter redemptions refunded on or before this datetime (ISO 8601 format, e.g. `2024-01-31T23:59:59Z`)
|
|
521
|
+
# @option opts [String] :sort Field to sort by, prefixed with `-` for descending order (e.g. `activation_datetime` or `-activation_datetime`)
|
|
522
|
+
# @option opts [Integer] :page (default to 1)
|
|
523
|
+
# @option opts [Integer] :per_page (default to 20)
|
|
524
|
+
# @return [ListRedemptions200Response]
|
|
525
|
+
def list_redemptions(promotion_id, opts = {})
|
|
526
|
+
data, _status_code, _headers = list_redemptions_with_http_info(promotion_id, opts)
|
|
527
|
+
data
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
# List all Redemptions
|
|
531
|
+
# Use this function to list the status of all redemptions created as part of a promotion.
|
|
532
|
+
# @param promotion_id [String] The promotion identifier
|
|
533
|
+
# @param [Hash] opts the optional parameters
|
|
534
|
+
# @option opts [String] :reward_sku
|
|
535
|
+
# @option opts [String] :email
|
|
536
|
+
# @option opts [String] :order_id
|
|
537
|
+
# @option opts [String] :state Redemption state filter (eg. `pending`, `redeemed`, `canceled`, etc.)
|
|
538
|
+
# @option opts [Time] :redeemed_datetime_start Filter redemptions redeemed on or after this datetime (ISO 8601 format, e.g. `2024-01-01T00:00:00Z`)
|
|
539
|
+
# @option opts [Time] :redeemed_datetime_end Filter redemptions redeemed on or before this datetime (ISO 8601 format, e.g. `2024-01-31T23:59:59Z`)
|
|
540
|
+
# @option opts [Time] :activation_datetime_start Filter redemptions activated on or after this datetime (ISO 8601 format, e.g. `2024-01-01T00:00:00Z`)
|
|
541
|
+
# @option opts [Time] :activation_datetime_end Filter redemptions activated on or before this datetime (ISO 8601 format, e.g. `2024-01-31T23:59:59Z`)
|
|
542
|
+
# @option opts [Time] :refund_datetime_start Filter redemptions refunded on or after this datetime (ISO 8601 format, e.g. `2024-01-01T00:00:00Z`)
|
|
543
|
+
# @option opts [Time] :refund_datetime_end Filter redemptions refunded on or before this datetime (ISO 8601 format, e.g. `2024-01-31T23:59:59Z`)
|
|
544
|
+
# @option opts [String] :sort Field to sort by, prefixed with `-` for descending order (e.g. `activation_datetime` or `-activation_datetime`)
|
|
545
|
+
# @option opts [Integer] :page (default to 1)
|
|
546
|
+
# @option opts [Integer] :per_page (default to 20)
|
|
547
|
+
# @return [Array<(ListRedemptions200Response, Integer, Hash)>] ListRedemptions200Response data, response status code and response headers
|
|
548
|
+
def list_redemptions_with_http_info(promotion_id, opts = {})
|
|
549
|
+
if @api_client.config.debugging
|
|
550
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.list_redemptions ...'
|
|
551
|
+
end
|
|
552
|
+
# verify the required parameter 'promotion_id' is set
|
|
553
|
+
if @api_client.config.client_side_validation && promotion_id.nil?
|
|
554
|
+
fail ArgumentError, "Missing the required parameter 'promotion_id' when calling RedemptionsApi.list_redemptions"
|
|
555
|
+
end
|
|
556
|
+
allowable_values = ["pending", "booked", "redeemed", "denied", "failed", "refunded", "blocked", "canceled", "expired"]
|
|
557
|
+
if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
|
|
558
|
+
fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
|
|
559
|
+
end
|
|
560
|
+
allowable_values = ["activation_datetime", "-activation_datetime", "updated_datetime", "-updated_datetime", "redeem_datetime", "-redeem_datetime", "refund_datetime", "-refund_datetime"]
|
|
561
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
|
562
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
|
563
|
+
end
|
|
564
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
565
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling RedemptionsApi.list_redemptions, must be greater than or equal to 1.'
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 10000
|
|
569
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling RedemptionsApi.list_redemptions, must be smaller than or equal to 10000.'
|
|
570
|
+
end
|
|
571
|
+
|
|
572
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
|
|
573
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling RedemptionsApi.list_redemptions, must be greater than or equal to 1.'
|
|
574
|
+
end
|
|
575
|
+
|
|
576
|
+
# resource path
|
|
577
|
+
local_var_path = '/fulfillment/v2/promotions/{promotion_id}/redemptions'.sub('{promotion_id}', CGI.escape(promotion_id.to_s))
|
|
578
|
+
|
|
579
|
+
# query parameters
|
|
580
|
+
query_params = opts[:query_params] || {}
|
|
581
|
+
query_params[:'reward_sku'] = opts[:'reward_sku'] if !opts[:'reward_sku'].nil?
|
|
582
|
+
query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?
|
|
583
|
+
query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil?
|
|
584
|
+
query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
|
|
585
|
+
query_params[:'redeemed_datetime_start'] = opts[:'redeemed_datetime_start'] if !opts[:'redeemed_datetime_start'].nil?
|
|
586
|
+
query_params[:'redeemed_datetime_end'] = opts[:'redeemed_datetime_end'] if !opts[:'redeemed_datetime_end'].nil?
|
|
587
|
+
query_params[:'activation_datetime_start'] = opts[:'activation_datetime_start'] if !opts[:'activation_datetime_start'].nil?
|
|
588
|
+
query_params[:'activation_datetime_end'] = opts[:'activation_datetime_end'] if !opts[:'activation_datetime_end'].nil?
|
|
589
|
+
query_params[:'refund_datetime_start'] = opts[:'refund_datetime_start'] if !opts[:'refund_datetime_start'].nil?
|
|
590
|
+
query_params[:'refund_datetime_end'] = opts[:'refund_datetime_end'] if !opts[:'refund_datetime_end'].nil?
|
|
591
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
|
592
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
593
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
|
594
|
+
|
|
595
|
+
# header parameters
|
|
596
|
+
header_params = opts[:header_params] || {}
|
|
597
|
+
# HTTP header 'Accept' (if needed)
|
|
598
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
599
|
+
|
|
600
|
+
# form parameters
|
|
601
|
+
form_params = opts[:form_params] || {}
|
|
602
|
+
|
|
603
|
+
# http body (model)
|
|
604
|
+
post_body = opts[:debug_body]
|
|
605
|
+
|
|
606
|
+
# return_type
|
|
607
|
+
return_type = opts[:debug_return_type] || 'ListRedemptions200Response'
|
|
608
|
+
|
|
609
|
+
# auth_names
|
|
610
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
611
|
+
|
|
612
|
+
new_options = opts.merge(
|
|
613
|
+
:operation => :"RedemptionsApi.list_redemptions",
|
|
614
|
+
:header_params => header_params,
|
|
615
|
+
:query_params => query_params,
|
|
616
|
+
:form_params => form_params,
|
|
617
|
+
:body => post_body,
|
|
618
|
+
:auth_names => auth_names,
|
|
619
|
+
:return_type => return_type
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
623
|
+
if @api_client.config.debugging
|
|
624
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#list_redemptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
625
|
+
end
|
|
626
|
+
return data, status_code, headers
|
|
627
|
+
end
|
|
628
|
+
|
|
629
|
+
# Redeem
|
|
630
|
+
# Use this function to perform a reward delivery from an existing redemption object.
|
|
631
|
+
# @param redemption_id [String] Unique Redemption identifier (eg. ZN7RS-9RNLY)
|
|
632
|
+
# @param [Hash] opts the optional parameters
|
|
633
|
+
# @option opts [ActivateRedemptionRequest] :activate_redemption_request
|
|
634
|
+
# @return [CreateRedemption201Response]
|
|
635
|
+
def redeem_redemption(redemption_id, opts = {})
|
|
636
|
+
data, _status_code, _headers = redeem_redemption_with_http_info(redemption_id, opts)
|
|
637
|
+
data
|
|
638
|
+
end
|
|
639
|
+
|
|
640
|
+
# Redeem
|
|
641
|
+
# Use this function to perform a reward delivery from an existing redemption object.
|
|
642
|
+
# @param redemption_id [String] Unique Redemption identifier (eg. ZN7RS-9RNLY)
|
|
643
|
+
# @param [Hash] opts the optional parameters
|
|
644
|
+
# @option opts [ActivateRedemptionRequest] :activate_redemption_request
|
|
645
|
+
# @return [Array<(CreateRedemption201Response, Integer, Hash)>] CreateRedemption201Response data, response status code and response headers
|
|
646
|
+
def redeem_redemption_with_http_info(redemption_id, opts = {})
|
|
647
|
+
if @api_client.config.debugging
|
|
648
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.redeem_redemption ...'
|
|
649
|
+
end
|
|
650
|
+
# verify the required parameter 'redemption_id' is set
|
|
651
|
+
if @api_client.config.client_side_validation && redemption_id.nil?
|
|
652
|
+
fail ArgumentError, "Missing the required parameter 'redemption_id' when calling RedemptionsApi.redeem_redemption"
|
|
653
|
+
end
|
|
654
|
+
# resource path
|
|
655
|
+
local_var_path = '/fulfillment/v2/redemptions/{redemption_id}/actions/redeem'.sub('{redemption_id}', CGI.escape(redemption_id.to_s))
|
|
656
|
+
|
|
657
|
+
# query parameters
|
|
658
|
+
query_params = opts[:query_params] || {}
|
|
659
|
+
|
|
660
|
+
# header parameters
|
|
661
|
+
header_params = opts[:header_params] || {}
|
|
662
|
+
# HTTP header 'Accept' (if needed)
|
|
663
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/pdf']) unless header_params['Accept']
|
|
664
|
+
# HTTP header 'Content-Type'
|
|
665
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
666
|
+
if !content_type.nil?
|
|
667
|
+
header_params['Content-Type'] = content_type
|
|
668
|
+
end
|
|
669
|
+
|
|
670
|
+
# form parameters
|
|
671
|
+
form_params = opts[:form_params] || {}
|
|
672
|
+
|
|
673
|
+
# http body (model)
|
|
674
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'activate_redemption_request'])
|
|
675
|
+
|
|
676
|
+
# return_type
|
|
677
|
+
return_type = opts[:debug_return_type] || 'CreateRedemption201Response'
|
|
678
|
+
|
|
679
|
+
# auth_names
|
|
680
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
681
|
+
|
|
682
|
+
new_options = opts.merge(
|
|
683
|
+
:operation => :"RedemptionsApi.redeem_redemption",
|
|
684
|
+
:header_params => header_params,
|
|
685
|
+
:query_params => query_params,
|
|
686
|
+
:form_params => form_params,
|
|
687
|
+
:body => post_body,
|
|
688
|
+
:auth_names => auth_names,
|
|
689
|
+
:return_type => return_type
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
693
|
+
if @api_client.config.debugging
|
|
694
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#redeem_redemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
695
|
+
end
|
|
696
|
+
return data, status_code, headers
|
|
697
|
+
end
|
|
698
|
+
|
|
699
|
+
# Refund
|
|
700
|
+
# Refunds a redemption if it is redeemed, or if debited = true and the state is booked, failed, or pending. Only redemptions from the current month are refundable.
|
|
701
|
+
# @param redemption_id [String] The redemption identifier
|
|
702
|
+
# @param [Hash] opts the optional parameters
|
|
703
|
+
# @return [CreateRedemption201Response]
|
|
704
|
+
def refund_redemption(redemption_id, opts = {})
|
|
705
|
+
data, _status_code, _headers = refund_redemption_with_http_info(redemption_id, opts)
|
|
706
|
+
data
|
|
707
|
+
end
|
|
708
|
+
|
|
709
|
+
# Refund
|
|
710
|
+
# Refunds a redemption if it is redeemed, or if debited = true and the state is booked, failed, or pending. Only redemptions from the current month are refundable.
|
|
711
|
+
# @param redemption_id [String] The redemption identifier
|
|
712
|
+
# @param [Hash] opts the optional parameters
|
|
713
|
+
# @return [Array<(CreateRedemption201Response, Integer, Hash)>] CreateRedemption201Response data, response status code and response headers
|
|
714
|
+
def refund_redemption_with_http_info(redemption_id, opts = {})
|
|
715
|
+
if @api_client.config.debugging
|
|
716
|
+
@api_client.config.logger.debug 'Calling API: RedemptionsApi.refund_redemption ...'
|
|
717
|
+
end
|
|
718
|
+
# verify the required parameter 'redemption_id' is set
|
|
719
|
+
if @api_client.config.client_side_validation && redemption_id.nil?
|
|
720
|
+
fail ArgumentError, "Missing the required parameter 'redemption_id' when calling RedemptionsApi.refund_redemption"
|
|
721
|
+
end
|
|
722
|
+
# resource path
|
|
723
|
+
local_var_path = '/fulfillment/v2/redemptions/{redemption_id}/actions/refund'.sub('{redemption_id}', CGI.escape(redemption_id.to_s))
|
|
724
|
+
|
|
725
|
+
# query parameters
|
|
726
|
+
query_params = opts[:query_params] || {}
|
|
727
|
+
|
|
728
|
+
# header parameters
|
|
729
|
+
header_params = opts[:header_params] || {}
|
|
730
|
+
# HTTP header 'Accept' (if needed)
|
|
731
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/pdf']) unless header_params['Accept']
|
|
732
|
+
|
|
733
|
+
# form parameters
|
|
734
|
+
form_params = opts[:form_params] || {}
|
|
735
|
+
|
|
736
|
+
# http body (model)
|
|
737
|
+
post_body = opts[:debug_body]
|
|
738
|
+
|
|
739
|
+
# return_type
|
|
740
|
+
return_type = opts[:debug_return_type] || 'CreateRedemption201Response'
|
|
741
|
+
|
|
742
|
+
# auth_names
|
|
743
|
+
auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']
|
|
744
|
+
|
|
745
|
+
new_options = opts.merge(
|
|
746
|
+
:operation => :"RedemptionsApi.refund_redemption",
|
|
747
|
+
:header_params => header_params,
|
|
748
|
+
:query_params => query_params,
|
|
749
|
+
:form_params => form_params,
|
|
750
|
+
:body => post_body,
|
|
751
|
+
:auth_names => auth_names,
|
|
752
|
+
:return_type => return_type
|
|
753
|
+
)
|
|
754
|
+
|
|
755
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
756
|
+
if @api_client.config.debugging
|
|
757
|
+
@api_client.config.logger.debug "API called: RedemptionsApi#refund_redemption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
758
|
+
end
|
|
759
|
+
return data, status_code, headers
|
|
760
|
+
end
|
|
761
|
+
end
|
|
762
|
+
end
|