Class: BillForward::CouponsApi
- Inherits:
-
Object
- Object
- BillForward::CouponsApi
- Defined in:
- lib/bf_ruby2/api/coupons_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_coupon(code, opts = {}) ⇒ CouponPagedMetadata
Create a coupon.
-
#create_coupon_unique_codes(code, opts = {}) ⇒ CouponUniqueCodesResponsePagedMetadata
Create a list of unique coupon codes that can be applied to a subscription.
-
#create_coupon_unique_codes_with_http_info(code, opts = {}) ⇒ Array<(CouponUniqueCodesResponsePagedMetadata, Fixnum, Hash)>
Create a list of unique coupon codes that can be applied to a subscription.
-
#create_coupon_with_http_info(code, opts = {}) ⇒ Array<(CouponPagedMetadata, Fixnum, Hash)>
Create a coupon.
-
#get_all_coupons(opts = {}) ⇒ CouponPagedMetadata
Returns a collection of all coupons.
-
#get_all_coupons_with_http_info(opts = {}) ⇒ Array<(CouponPagedMetadata, Fixnum, Hash)>
Returns a collection of all coupons.
-
#get_applied_coupons(code, opts = {}) ⇒ CouponPagedMetadata
Returns a list of unique coupons which have been applied.
-
#get_applied_coupons_with_http_info(code, opts = {}) ⇒ Array<(CouponPagedMetadata, Fixnum, Hash)>
Returns a list of unique coupons which have been applied.
-
#get_available_coupon_codes_for_code(code, opts = {}) ⇒ CouponUniqueCodesResponsePagedMetadata
Returns a list of available unique coupon codes for the specified parent coupon code that can be applied to a subscription.
-
#get_available_coupon_codes_for_code_with_http_info(code, opts = {}) ⇒ Array<(CouponUniqueCodesResponsePagedMetadata, Fixnum, Hash)>
Returns a list of available unique coupon codes for the specified parent coupon code that can be applied to a subscription.
-
#get_coupon_code(code, opts = {}) ⇒ CouponUniqueCodesResponsePagedMetadata
Returns the coupon for the specified code that can be applied to a subscription.
-
#get_coupon_code_with_http_info(code, opts = {}) ⇒ Array<(CouponUniqueCodesResponsePagedMetadata, Fixnum, Hash)>
Returns the coupon for the specified code that can be applied to a subscription.
-
#get_subscription_applications_of_coupons(code, opts = {}) ⇒ SubscriptionPagedMetadata
Retrieves a collection of the coupons by this coupon code which have been applied.
-
#get_subscription_applications_of_coupons_with_http_info(code, opts = {}) ⇒ Array<(SubscriptionPagedMetadata, Fixnum, Hash)>
Retrieves a collection of the coupons by this coupon code which have been applied.
-
#initialize(api_client = ApiClient.default) ⇒ CouponsApi
constructor
A new instance of CouponsApi.
-
#retire_coupon(code, organizations, opts = {}) ⇒ CouponPagedMetadata
<p>This method has 2 main behaviours depending on what is passed in.
-
#retire_coupon_with_http_info(code, organizations, opts = {}) ⇒ Array<(CouponPagedMetadata, Fixnum, Hash)>
<p>This method has 2 main behaviours depending on what is passed in.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ CouponsApi
Returns a new instance of CouponsApi.
30 31 32 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 30 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
28 29 30 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 28 def api_client @api_client end |
Instance Method Details
#create_coupon(code, opts = {}) ⇒ CouponPagedMetadata
Create a coupon. a new coupon","request":"createCouponRequest.html","response":"createCouponResponse.html"
39 40 41 42 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 39 def create_coupon(code, opts = {}) data, _status_code, _headers = create_coupon_with_http_info(code, opts) return data end |
#create_coupon_unique_codes(code, opts = {}) ⇒ CouponUniqueCodesResponsePagedMetadata
Create a list of unique coupon codes that can be applied to a subscription. { "nickname":"Create unique coupon codes","request":"createUniqueCodesRequest.html","response":"createUniqueCodesResponse.html"}
97 98 99 100 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 97 def create_coupon_unique_codes(code, opts = {}) data, _status_code, _headers = create_coupon_unique_codes_with_http_info(code, opts) return data end |
#create_coupon_unique_codes_with_http_info(code, opts = {}) ⇒ Array<(CouponUniqueCodesResponsePagedMetadata, Fixnum, Hash)>
Create a list of unique coupon codes that can be applied to a subscription. { "nickname":"Create unique coupon codes","request":"createUniqueCodesRequest.html","response":"createUniqueCodesResponse.html"}
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 108 def create_coupon_unique_codes_with_http_info(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CouponsApi.create_coupon_unique_codes ..." end # verify the required parameter 'code' is set fail ArgumentError, "Missing the required parameter 'code' when calling CouponsApi.create_coupon_unique_codes" if code.nil? # resource path local_var_path = "/coupons/{code}/codes".sub('{format}','json').sub('{' + 'code' + '}', code.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json; charset=utf-8'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['application/json; charset=utf-8'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'request']) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CouponUniqueCodesResponsePagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: CouponsApi#create_coupon_unique_codes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_coupon_with_http_info(code, opts = {}) ⇒ Array<(CouponPagedMetadata, Fixnum, Hash)>
Create a coupon. a new coupon","request":"createCouponRequest.html","response":"createCouponResponse.html"
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 49 def create_coupon_with_http_info(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CouponsApi.create_coupon ..." end # verify the required parameter 'code' is set fail ArgumentError, "Missing the required parameter 'code' when calling CouponsApi.create_coupon" if code.nil? # resource path local_var_path = "/coupons".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json; charset=utf-8'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['application/json; charset=utf-8'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(code) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CouponPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: CouponsApi#create_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_all_coupons(opts = {}) ⇒ CouponPagedMetadata
Returns a collection of all coupons. By default 10 values are returned. Records are returned in natural order. { "nickname":"Retrieve all coupons","response":"getCouponAll.html"}
160 161 162 163 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 160 def get_all_coupons(opts = {}) data, _status_code, _headers = get_all_coupons_with_http_info(opts) return data end |
#get_all_coupons_with_http_info(opts = {}) ⇒ Array<(CouponPagedMetadata, Fixnum, Hash)>
Returns a collection of all coupons. By default 10 values are returned. Records are returned in natural order. { "nickname":"Retrieve all coupons","response":"getCouponAll.html"}
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 175 def get_all_coupons_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CouponsApi.get_all_coupons ..." end if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC' end # resource path local_var_path = "/coupons".sub('{format}','json') # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'include_retired'] = opts[:'include_retired'] if !opts[:'include_retired'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json; charset=utf-8'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = [] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CouponPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: CouponsApi#get_all_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_applied_coupons(code, opts = {}) ⇒ CouponPagedMetadata
Returns a list of unique coupons which have been applied. { "nickname":"Retrieve used unique coupons","response":"getAppliedCodesForCode.html"}
235 236 237 238 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 235 def get_applied_coupons(code, opts = {}) data, _status_code, _headers = get_applied_coupons_with_http_info(code, opts) return data end |
#get_applied_coupons_with_http_info(code, opts = {}) ⇒ Array<(CouponPagedMetadata, Fixnum, Hash)>
Returns a list of unique coupons which have been applied. { "nickname":"Retrieve used unique coupons","response":"getAppliedCodesForCode.html"}
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 251 def get_applied_coupons_with_http_info(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CouponsApi.get_applied_coupons ..." end # verify the required parameter 'code' is set fail ArgumentError, "Missing the required parameter 'code' when calling CouponsApi.get_applied_coupons" if code.nil? if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC' end # resource path local_var_path = "/coupons/{code}/applied".sub('{format}','json').sub('{' + 'code' + '}', code.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'include_retired'] = opts[:'include_retired'] if !opts[:'include_retired'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json; charset=utf-8'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['text/plain'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CouponPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: CouponsApi#get_applied_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_available_coupon_codes_for_code(code, opts = {}) ⇒ CouponUniqueCodesResponsePagedMetadata
Returns a list of available unique coupon codes for the specified parent coupon code that can be applied to a subscription. { "nickname":"Retrieve unused unique coupons","response":"getAvailableCodesForCode.html"}
313 314 315 316 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 313 def get_available_coupon_codes_for_code(code, opts = {}) data, _status_code, _headers = get_available_coupon_codes_for_code_with_http_info(code, opts) return data end |
#get_available_coupon_codes_for_code_with_http_info(code, opts = {}) ⇒ Array<(CouponUniqueCodesResponsePagedMetadata, Fixnum, Hash)>
Returns a list of available unique coupon codes for the specified parent coupon code that can be applied to a subscription. { "nickname":"Retrieve unused unique coupons","response":"getAvailableCodesForCode.html"}
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 329 def get_available_coupon_codes_for_code_with_http_info(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CouponsApi.get_available_coupon_codes_for_code ..." end # verify the required parameter 'code' is set fail ArgumentError, "Missing the required parameter 'code' when calling CouponsApi.get_available_coupon_codes_for_code" if code.nil? if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC' end # resource path local_var_path = "/coupons/{code}/codes".sub('{format}','json').sub('{' + 'code' + '}', code.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'include_retired'] = opts[:'include_retired'] if !opts[:'include_retired'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json; charset=utf-8'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['text/plain'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CouponUniqueCodesResponsePagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: CouponsApi#get_available_coupon_codes_for_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_coupon_code(code, opts = {}) ⇒ CouponUniqueCodesResponsePagedMetadata
Returns the coupon for the specified code that can be applied to a subscription. { "nickname":"Retrieve coupon","response":"getCouponByCode.html"}
386 387 388 389 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 386 def get_coupon_code(code, opts = {}) data, _status_code, _headers = get_coupon_code_with_http_info(code, opts) return data end |
#get_coupon_code_with_http_info(code, opts = {}) ⇒ Array<(CouponUniqueCodesResponsePagedMetadata, Fixnum, Hash)>
Returns the coupon for the specified code that can be applied to a subscription. { "nickname":"Retrieve coupon","response":"getCouponByCode.html"}
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 397 def get_coupon_code_with_http_info(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CouponsApi.get_coupon_code ..." end # verify the required parameter 'code' is set fail ArgumentError, "Missing the required parameter 'code' when calling CouponsApi.get_coupon_code" if code.nil? # resource path local_var_path = "/coupons/{code}".sub('{format}','json').sub('{' + 'code' + '}', code.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json; charset=utf-8'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['text/plain'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CouponUniqueCodesResponsePagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: CouponsApi#get_coupon_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_subscription_applications_of_coupons(code, opts = {}) ⇒ SubscriptionPagedMetadata
Retrieves a collection of the coupons by this coupon code which have been applied. { "nickname":"Retrieve subscriptions to which the given coupon code has been applied.","response":"getSubscriptionApplications.html"}
451 452 453 454 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 451 def get_subscription_applications_of_coupons(code, opts = {}) data, _status_code, _headers = get_subscription_applications_of_coupons_with_http_info(code, opts) return data end |
#get_subscription_applications_of_coupons_with_http_info(code, opts = {}) ⇒ Array<(SubscriptionPagedMetadata, Fixnum, Hash)>
Retrieves a collection of the coupons by this coupon code which have been applied. { "nickname":"Retrieve subscriptions to which the given coupon code has been applied.","response":"getSubscriptionApplications.html"}
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 467 def get_subscription_applications_of_coupons_with_http_info(code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CouponsApi.get_subscription_applications_of_coupons ..." end # verify the required parameter 'code' is set fail ArgumentError, "Missing the required parameter 'code' when calling CouponsApi.get_subscription_applications_of_coupons" if code.nil? if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC' end # resource path local_var_path = "/coupons/{code}/subscriptions".sub('{format}','json').sub('{' + 'code' + '}', code.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'include_retired'] = opts[:'include_retired'] if !opts[:'include_retired'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json; charset=utf-8'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['text/plain'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'SubscriptionPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: CouponsApi#get_subscription_applications_of_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#retire_coupon(code, organizations, opts = {}) ⇒ CouponPagedMetadata
<p>This method has 2 main behaviours depending on what is passed in. If the parent coupon code, for example SUMMER, is given no new coupons can be issued or claimed from this code. Deleting will result in the deleted property being set to true.</p><p>If a unique coupon code, for example SUMMER-AGH8, is given this will stop the coupon from being applied to the subscription from that point onwards. When a coupon is deleted the validUntil property is set which is the date/time it stopped applying to the target.</p> { "nickname":"Retire coupon","response":"retireCoupon.html"}
524 525 526 527 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 524 def retire_coupon(code, organizations, opts = {}) data, _status_code, _headers = retire_coupon_with_http_info(code, organizations, opts) return data end |
#retire_coupon_with_http_info(code, organizations, opts = {}) ⇒ Array<(CouponPagedMetadata, Fixnum, Hash)>
<p>This method has 2 main behaviours depending on what is passed in. If the parent coupon code, for example SUMMER, is given no new coupons can be issued or claimed from this code. Deleting will result in the deleted property being set to true.</p><p>If a unique coupon code, for example SUMMER-AGH8, is given this will stop the coupon from being applied to the subscription from that point onwards. When a coupon is deleted the validUntil property is set which is the date/time it stopped applying to the target.</p> { "nickname":"Retire coupon","response":"retireCoupon.html"}
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/bf_ruby2/api/coupons_api.rb', line 535 def retire_coupon_with_http_info(code, organizations, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CouponsApi.retire_coupon ..." end # verify the required parameter 'code' is set fail ArgumentError, "Missing the required parameter 'code' when calling CouponsApi.retire_coupon" if code.nil? # verify the required parameter 'organizations' is set fail ArgumentError, "Missing the required parameter 'organizations' when calling CouponsApi.retire_coupon" if organizations.nil? # resource path local_var_path = "/coupons/{code}".sub('{format}','json').sub('{' + 'code' + '}', code.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(organizations, :multi) # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json; charset=utf-8'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['text/plain'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CouponPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: CouponsApi#retire_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |