Class: LoyaltyApIs::OfferApi
- Defined in:
- lib/loyalty_ap_is/apis/offer_api.rb
Overview
OfferApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#assign_partner_offer(language_code, user_authorization_token, country_code, x_correlation_id: nil, channel: nil, application: nil, body: nil) ⇒ ApiResponse
Assigning a partner based offer to a customer by the partner of language in lower case as per ISO 639-1 , “-” and country code as per ISO 3166-1 alpha-2.
-
#revoke_partner_offer(language_code, user_authorization_token, client_authorization_token, country_code, consumer_uuid, partner_reference_id, x_correlation_id: nil, channel: nil, application: nil) ⇒ ApiResponse
Revoking a partner based offer from customer by Partner.
Methods inherited from BaseApi
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from LoyaltyApIs::BaseApi
Instance Method Details
#assign_partner_offer(language_code, user_authorization_token, country_code, x_correlation_id: nil, channel: nil, application: nil, body: nil) ⇒ ApiResponse
Assigning a partner based offer to a customer by the partner
of language in lower case as per ISO 639-1 , “-” and country code as per
ISO 3166-1 alpha-2.
the accessToken retrieved from the /auth/exchangeAccessCode endpoint.
This is referred to as user-authorization-token where the access is
provided by the end user.
alpha-2 country code.
format in order to track the request.
customer
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 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 |
# File 'lib/loyalty_ap_is/apis/offer_api.rb', line 26 def assign_partner_offer(language_code, , country_code, x_correlation_id: nil, channel: nil, application: nil, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/consumers/offers', Server::SHELL1) .query_param(new_parameter(language_code, key: 'language_code') .is_required(true)) .header_param(new_parameter(, key: 'user-authorization-token') .is_required(true)) .header_param(new_parameter(country_code, key: 'country-code') .is_required(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(x_correlation_id, key: 'x-correlation-id')) .header_param(new_parameter(channel, key: 'channel')) .header_param(new_parameter(application, key: 'application')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('client-authorization-token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Offer.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad request as certain mandatory parameters were not provided'\ ' by the client in the request.', CommonErrorException) .local_error('401', 'Unauthorized request, Missing Authorization header, or expired'\ ' authorization token.', CommonErrorException) .local_error('404', 'Offer/Customer does not exist.', CommonErrorException) .local_error('422', 'All offer assignment based error what it caused by the'\ ' "Offer"', CommonErrorException) .local_error('429', "Rate limit hit. See Retry-After header for a minimum amount of'\ ' delay, but note that there is no guarantee\nthat subsequent'\ ' request won't be limited.\n", APIException) .local_error('500', 'Internal server error', APIException)) .execute end |
#revoke_partner_offer(language_code, user_authorization_token, client_authorization_token, country_code, consumer_uuid, partner_reference_id, x_correlation_id: nil, channel: nil, application: nil) ⇒ ApiResponse
Revoking a partner based offer from customer by Partner.
of language in lower case as per ISO 639-1 , “-” and country code as per
ISO 3166-1 alpha-2.
the accessToken retrieved from the /auth/exchangeAccessCode endpoint.
This is referred to as user-authorization-token where the access is
provided by the end user.
of the accessToken retrieved from the /oauth/token endpoint. This is
client authorization between Shell and Partner system.
alpha-2 country code.
user signed in with Shell credentials.
Reference ID for the transaction which was used when assigning the offer
from the partner in Assign Offer API
format in order to track the request.
104 105 106 107 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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/loyalty_ap_is/apis/offer_api.rb', line 104 def revoke_partner_offer(language_code, , , country_code, consumer_uuid, partner_reference_id, x_correlation_id: nil, channel: nil, application: nil) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/consumers/offers', Server::SHELL1) .query_param(new_parameter(language_code, key: 'language_code') .is_required(true)) .header_param(new_parameter(, key: 'user-authorization-token') .is_required(true)) .header_param(new_parameter(, key: 'client-authorization-token') .is_required(true)) .header_param(new_parameter(country_code, key: 'country-code') .is_required(true)) .header_param(new_parameter(consumer_uuid, key: 'consumerUUID') .is_required(true)) .header_param(new_parameter(partner_reference_id, key: 'partnerReferenceId') .is_required(true)) .header_param(new_parameter(x_correlation_id, key: 'x-correlation-id')) .header_param(new_parameter(channel, key: 'channel')) .header_param(new_parameter(application, key: 'application')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('client-authorization-token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Offer.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad request as certain mandatory parameters were not provided'\ ' by the client in the request.', CommonErrorException) .local_error('401', 'Unauthorized request, Missing Authorization header, or expired'\ ' authorization token.', CommonErrorException) .local_error('404', 'Offer/Customer does not exist.', CommonErrorException) .local_error('422', 'All offer assignment based error what it caused by the'\ ' "Offer"', CommonErrorException) .local_error('429', "Rate limit hit. See Retry-After header for a minimum amount of'\ ' delay, but note that there is no guarantee\nthat subsequent'\ ' request won't be limited.\n", APIException) .local_error('500', 'Internal server error', APIException)) .execute end |