Class: AdvancedBilling::ReferralCodesController
- Inherits:
-
BaseController
- Object
- BaseController
- AdvancedBilling::ReferralCodesController
- Defined in:
- lib/advanced_billing/controllers/referral_codes_controller.rb
Overview
ReferralCodesController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#validate_referral_code(code) ⇒ ReferralValidationResponse
Validates whether a referral code is valid and applicable within your site.
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 AdvancedBilling::BaseController
Instance Method Details
#validate_referral_code(code) ⇒ ReferralValidationResponse
Validates whether a referral code is valid and applicable within your site. This method is useful for validating referral codes that are entered by a customer. For more information, see [Understanding Referrals](https://docs.maxio.com/hc/en-us/articles/24286981223693-Underst anding-Referrals) in the product documentation. to validate
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/advanced_billing/controllers/referral_codes_controller.rb', line 18 def validate_referral_code(code) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/referral_codes/validate.json', Server::PRODUCTION) .query_param(new_parameter(code, key: 'code') .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ReferralValidationResponse.method(:from_hash)) .local_error_template('404', 'Invalid referral code.', SingleStringErrorResponseException)) .execute end |