Class: CtdDocumentation::LicenseController
- Inherits:
-
BaseController
- Object
- BaseController
- CtdDocumentation::LicenseController
- Defined in:
- lib/ctd_documentation/controllers/license_controller.rb
Overview
LicenseController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#add_license(site_id, body) ⇒ UpdateLicenseResponse
Add License.
-
#get_license_details(site_id) ⇒ GetLicenseDetailsResponse
Admin users can get the current license details.
-
#update_license(site_id, body) ⇒ UpdateLicenseResponse
Update license.
Methods inherited from BaseController
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from CtdDocumentation::BaseController
Instance Method Details
#add_license(site_id, body) ⇒ UpdateLicenseResponse
Add License
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ctd_documentation/controllers/license_controller.rb', line 31 def add_license(site_id, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/ranger/license/{site_id}', Server::DEFAULT) .template_param(new_parameter(site_id, key: 'site_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .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('global'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UpdateLicenseResponse.method(:from_hash))) .execute end |
#get_license_details(site_id) ⇒ GetLicenseDetailsResponse
Admin users can get the current license details
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ctd_documentation/controllers/license_controller.rb', line 12 def get_license_details(site_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/ranger/license/{site_id}', Server::DEFAULT) .template_param(new_parameter(site_id, key: 'site_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetLicenseDetailsResponse.method(:from_hash))) .execute end |
#update_license(site_id, body) ⇒ UpdateLicenseResponse
Update license
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ctd_documentation/controllers/license_controller.rb', line 54 def update_license(site_id, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/ranger/license/{site_id}', Server::DEFAULT) .template_param(new_parameter(site_id, key: 'site_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .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('global'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UpdateLicenseResponse.method(:from_hash))) .execute end |