Class: StickyIoRestfulApiV2025731::PromoCodesController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/controllers/promo_codes_controller.rb

Overview

PromoCodesController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from StickyIoRestfulApiV2025731::BaseController

Instance Method Details

#create_promo_code(body, domain, v2_ext) ⇒ ApiResponse

Create a promo code In this api you will receive an “id” in the response and then use this “id” in request data of “Update Coupon Profile” Api to add it into respective coupon profile. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | name | Required | - | String | The promo code. | description here

Parameters:

  • body (CreatePromoCodeRequest)

    Required parameter: TODO: type

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/sticky_io_restful_api_v2025731/controllers/promo_codes_controller.rb', line 113

def create_promo_code(body,
                      domain,
                      v2_ext)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/.{domain}{v2_ext}coupons/promo_codes',
                                 Server::SERVER_1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .template_param(new_parameter(domain, key: 'domain')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(v2_ext, key: 'v2_ext')
                                .is_required(true)
                                .should_encode(true))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('basic')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end

#delete_promo_code(body, domain, v2_ext, promo_code_id) ⇒ ApiResponse

Delete an existing promo code. description here here

Parameters:

  • body (DeletePromoCodeRequest)

    Required parameter: TODO: type

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

  • promo_code_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/sticky_io_restful_api_v2025731/controllers/promo_codes_controller.rb', line 145

def delete_promo_code(body,
                      domain,
                      v2_ext,
                      promo_code_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/.{domain}{v2_ext}coupons/promo_codes/{promo_code_id}',
                                 Server::SERVER_1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .template_param(new_parameter(domain, key: 'domain')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(v2_ext, key: 'v2_ext')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(promo_code_id, key: 'promo_code_id')
                                .is_required(true)
                                .should_encode(true))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('basic')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end

#get_profile_promo_codes(domain, v2_ext, coupon_profile_id) ⇒ ApiResponse

Fetch a list of all promo codes attached to the coupon profile ID **Response Data**\ Response parameters expected in promo code object contained within the ‘data` field array: | Field | Data Type | Description | ————————————— | ———— | ————————————– | | id | Integer | The promo code ID. | use_count | Integer | The promo code usage count. | code | String | The promo code. | is_active | Integer Flag | The promo code active status. | is_deleted | Integer Flag | The promo code deleted status. | created_at | Object | Object that contains data pertaining to the promo code’s creation. | created_at.date | String | The promo code creation timestamp. | created_at.timezone_type | String | The promo code timezone type ID. | created_at.timezone | String | The promo code creation timestamp timezone. | created_by | Integer | The user ID that created the promo code. description here

Parameters:

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

  • coupon_profile_id (String)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/sticky_io_restful_api_v2025731/controllers/promo_codes_controller.rb', line 75

def get_profile_promo_codes(domain,
                            v2_ext,
                            coupon_profile_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/.{domain}{v2_ext}coupons/{coupon_profile_id}/promo_codes',
                                 Server::SERVER_1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .template_param(new_parameter(domain, key: 'domain')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(v2_ext, key: 'v2_ext')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(coupon_profile_id, key: 'coupon_profile_id')
                                .is_required(true)
                                .should_encode(true))
               .auth(Single.new('basic')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end

#get_promo_codes(domain, v2_ext) ⇒ ApiResponse

Fetch a list of all promo codes **Response Data**\ Response parameters expected in promo code object contained within the ‘data` field array: | Field | Data Type | Description | ————————————— | ———— | ————————————– | | id | Integer | The promo code ID. | use_count | Integer | The promo code usage count. | code | String | The promo code. | is_active | Integer Flag | The promo code active status. | is_deleted | Integer Flag | The promo code deleted status. | created_at | Object | Object that contains data pertaining to the promo code’s creation. | created_at.date | String | The promo code creation timestamp. | created_at.timezone_type | String | The promo code timezone type ID. | created_at.timezone | String | The promo code creation timestamp timezone. | created_by | Integer | The user ID that created the promo code.

Parameters:

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/sticky_io_restful_api_v2025731/controllers/promo_codes_controller.rb', line 31

def get_promo_codes(domain,
                    v2_ext)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/.{domain}{v2_ext}coupons/promo_codes',
                                 Server::SERVER_1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .template_param(new_parameter(domain, key: 'domain')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(v2_ext, key: 'v2_ext')
                                .is_required(true)
                                .should_encode(true))
               .auth(Single.new('basic')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end