Class: AdvancedBilling::BaseController
- Inherits:
-
Object
- Object
- AdvancedBilling::BaseController
- Includes:
- CoreLibrary
- Defined in:
- lib/advanced_billing/controllers/base_controller.rb
Overview
BaseController.
Direct Known Subclasses
APIExportsController, AdvanceInvoiceController, BillingPortalController, ComponentPricePointsController, ComponentsController, CouponsController, CustomFieldsController, CustomersController, EventsBasedBillingSegmentsController, EventsController, InsightsController, InvoicesController, OffersController, PaymentProfilesController, ProductFamiliesController, ProductPricePointsController, ProductsController, ProformaInvoicesController, ReasonCodesController, ReferralCodesController, SalesCommissionsController, SitesController, SubscriptionComponentsController, SubscriptionGroupInvoiceAccountController, SubscriptionGroupStatusController, SubscriptionGroupsController, SubscriptionInvoiceAccountController, SubscriptionNotesController, SubscriptionProductsController, SubscriptionStatusController, SubscriptionsController, WebhooksController
Constant Summary collapse
- GLOBAL_ERRORS =
{ 'default' => ErrorCase.new .('HTTP Response Not OK. Status code:'\ ' {$statusCode}. Response: \'{$response.body}'\ '\'.') .exception_type(APIException), '404' => ErrorCase.new .('Not Found:\'{$response.body}\'') .exception_type(APIException) }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#http_call_back ⇒ Object
Returns the value of attribute http_call_back.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(global_configuration) ⇒ BaseController
constructor
Initialization constructor.
-
#new_api_call_builder ⇒ ApiCall
Creates a new builder for the Api Call instance.
-
#new_parameter(value, key: nil) ⇒ Parameter
Creates a new instance of the parameter.
-
#new_request_builder(http_method, path, server) ⇒ RequestBuilder
Creates a new instance of the request builder.
-
#new_response_handler ⇒ ResponseHandler
Creates a new instance of the response handler.
Constructor Details
#initialize(global_configuration) ⇒ BaseController
Initialization constructor.
35 36 37 38 39 40 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 35 def initialize(global_configuration) @global_configuration = global_configuration @config = @global_configuration.client_configuration @http_call_back = @config.http_callback @api_call = ApiCall.new(@global_configuration) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
10 11 12 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 10 def config @config end |
#http_call_back ⇒ Object
Returns the value of attribute http_call_back.
10 11 12 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 10 def http_call_back @http_call_back end |
Class Method Details
.user_agent ⇒ Object
12 13 14 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 12 def self.user_agent 'AB SDK Ruby:6.0.0 on OS {os-info}' end |
.user_agent_parameters ⇒ Object
16 17 18 19 20 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 16 def self.user_agent_parameters { '{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false } } end |
Instance Method Details
#new_api_call_builder ⇒ ApiCall
Creates a new builder for the Api Call instance.
44 45 46 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 44 def new_api_call_builder @api_call.new_builder end |
#new_parameter(value, key: nil) ⇒ Parameter
Creates a new instance of the parameter.
70 71 72 73 74 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 70 def new_parameter(value, key: nil) Parameter.new .key(key) .value(value) end |
#new_request_builder(http_method, path, server) ⇒ RequestBuilder
Creates a new instance of the request builder.
53 54 55 56 57 58 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 53 def new_request_builder(http_method, path, server) RequestBuilder.new .http_method(http_method) .path(path) .server(server) end |
#new_response_handler ⇒ ResponseHandler
Creates a new instance of the response handler.
62 63 64 |
# File 'lib/advanced_billing/controllers/base_controller.rb', line 62 def new_response_handler ResponseHandler.new end |