Class: AdvancedBilling::Client
- Inherits:
-
Object
- Object
- AdvancedBilling::Client
- Includes:
- CoreLibrary
- Defined in:
- lib/advanced_billing/client.rb
Overview
advanced_billing client class.
Instance Attribute Summary collapse
-
#auth_managers ⇒ Object
readonly
Returns the value of attribute auth_managers.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#advance_invoice ⇒ AdvanceInvoiceController
Access to advance_invoice controller.
-
#api_exports ⇒ APIExportsController
Access to api_exports controller.
-
#billing_portal ⇒ BillingPortalController
Access to billing_portal controller.
-
#component_price_points ⇒ ComponentPricePointsController
Access to component_price_points controller.
-
#components ⇒ ComponentsController
Access to components controller.
-
#coupons ⇒ CouponsController
Access to coupons controller.
-
#custom_fields ⇒ CustomFieldsController
Access to custom_fields controller.
-
#customers ⇒ CustomersController
Access to customers controller.
-
#events ⇒ EventsController
Access to events controller.
-
#events_based_billing_segments ⇒ EventsBasedBillingSegmentsController
Access to events_based_billing_segments controller.
-
#initialize(connection: nil, adapter: :net_http_persistent, timeout: 120, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put],, http_callback: nil, environment: Environment::PRODUCTION, subdomain: 'subdomain', domain: 'chargify.com', basic_auth_credentials: nil, config: nil) ⇒ Client
constructor
A new instance of Client.
-
#initialize_auth_managers(global_config) ⇒ Object
Initializes the auth managers hash used for authenticating API calls.
-
#insights ⇒ InsightsController
Access to insights controller.
-
#invoices ⇒ InvoicesController
Access to invoices controller.
-
#offers ⇒ OffersController
Access to offers controller.
-
#payment_profiles ⇒ PaymentProfilesController
Access to payment_profiles controller.
-
#product_families ⇒ ProductFamiliesController
Access to product_families controller.
-
#product_price_points ⇒ ProductPricePointsController
Access to product_price_points controller.
-
#products ⇒ ProductsController
Access to products controller.
-
#proforma_invoices ⇒ ProformaInvoicesController
Access to proforma_invoices controller.
-
#reason_codes ⇒ ReasonCodesController
Access to reason_codes controller.
-
#referral_codes ⇒ ReferralCodesController
Access to referral_codes controller.
-
#sales_commissions ⇒ SalesCommissionsController
Access to sales_commissions controller.
-
#sites ⇒ SitesController
Access to sites controller.
-
#subscription_components ⇒ SubscriptionComponentsController
Access to subscription_components controller.
-
#subscription_group_invoice_account ⇒ SubscriptionGroupInvoiceAccountController
Access to subscription_group_invoice_account controller.
-
#subscription_group_status ⇒ SubscriptionGroupStatusController
Access to subscription_group_status controller.
-
#subscription_groups ⇒ SubscriptionGroupsController
Access to subscription_groups controller.
-
#subscription_invoice_account ⇒ SubscriptionInvoiceAccountController
Access to subscription_invoice_account controller.
-
#subscription_notes ⇒ SubscriptionNotesController
Access to subscription_notes controller.
-
#subscription_products ⇒ SubscriptionProductsController
Access to subscription_products controller.
-
#subscription_status ⇒ SubscriptionStatusController
Access to subscription_status controller.
-
#subscriptions ⇒ SubscriptionsController
Access to subscriptions controller.
-
#webhooks ⇒ WebhooksController
Access to webhooks controller.
Constructor Details
#initialize(connection: nil, adapter: :net_http_persistent, timeout: 120, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put],, http_callback: nil, environment: Environment::PRODUCTION, subdomain: 'subdomain', domain: 'chargify.com', basic_auth_credentials: nil, config: nil) ⇒ Client
Returns a new instance of Client.
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/advanced_billing/client.rb', line 204 def initialize( connection: nil, adapter: :net_http_persistent, timeout: 120, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put], http_callback: nil, environment: Environment::PRODUCTION, subdomain: 'subdomain', domain: 'chargify.com', basic_auth_credentials: nil, config: nil ) @config = if config.nil? Configuration.new( connection: connection, adapter: adapter, timeout: timeout, max_retries: max_retries, retry_interval: retry_interval, backoff_factor: backoff_factor, retry_statuses: retry_statuses, retry_methods: retry_methods, http_callback: http_callback, environment: environment, subdomain: subdomain, domain: domain, basic_auth_credentials: basic_auth_credentials ) else config end user_agent_params = BaseController.user_agent_parameters @global_configuration = GlobalConfiguration.new(client_configuration: @config) .base_uri_executor(@config.method(:get_base_uri)) .global_errors(BaseController::GLOBAL_ERRORS) .user_agent(BaseController.user_agent, agent_parameters: user_agent_params) initialize_auth_managers(@global_configuration) @global_configuration = @global_configuration.auth_managers(@auth_managers) end |
Instance Attribute Details
#auth_managers ⇒ Object (readonly)
Returns the value of attribute auth_managers.
10 11 12 |
# File 'lib/advanced_billing/client.rb', line 10 def auth_managers @auth_managers end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/advanced_billing/client.rb', line 10 def config @config end |
Instance Method Details
#advance_invoice ⇒ AdvanceInvoiceController
Access to advance_invoice controller.
20 21 22 |
# File 'lib/advanced_billing/client.rb', line 20 def advance_invoice @advance_invoice ||= AdvanceInvoiceController.new @global_configuration end |
#api_exports ⇒ APIExportsController
Access to api_exports controller.
14 15 16 |
# File 'lib/advanced_billing/client.rb', line 14 def api_exports @api_exports ||= APIExportsController.new @global_configuration end |
#billing_portal ⇒ BillingPortalController
Access to billing_portal controller.
26 27 28 |
# File 'lib/advanced_billing/client.rb', line 26 def billing_portal @billing_portal ||= BillingPortalController.new @global_configuration end |
#component_price_points ⇒ ComponentPricePointsController
Access to component_price_points controller.
44 45 46 |
# File 'lib/advanced_billing/client.rb', line 44 def component_price_points @component_price_points ||= ComponentPricePointsController.new @global_configuration end |
#components ⇒ ComponentsController
Access to components controller.
38 39 40 |
# File 'lib/advanced_billing/client.rb', line 38 def components @components ||= ComponentsController.new @global_configuration end |
#coupons ⇒ CouponsController
Access to coupons controller.
32 33 34 |
# File 'lib/advanced_billing/client.rb', line 32 def coupons @coupons ||= CouponsController.new @global_configuration end |
#custom_fields ⇒ CustomFieldsController
Access to custom_fields controller.
56 57 58 |
# File 'lib/advanced_billing/client.rb', line 56 def custom_fields @custom_fields ||= CustomFieldsController.new @global_configuration end |
#customers ⇒ CustomersController
Access to customers controller.
50 51 52 |
# File 'lib/advanced_billing/client.rb', line 50 def customers @customers ||= CustomersController.new @global_configuration end |
#events ⇒ EventsController
Access to events controller.
62 63 64 |
# File 'lib/advanced_billing/client.rb', line 62 def events @events ||= EventsController.new @global_configuration end |
#events_based_billing_segments ⇒ EventsBasedBillingSegmentsController
Access to events_based_billing_segments controller.
68 69 70 |
# File 'lib/advanced_billing/client.rb', line 68 def events_based_billing_segments @events_based_billing_segments ||= EventsBasedBillingSegmentsController.new @global_configuration end |
#initialize_auth_managers(global_config) ⇒ Object
Initializes the auth managers hash used for authenticating API calls.
240 241 242 243 244 245 |
# File 'lib/advanced_billing/client.rb', line 240 def initialize_auth_managers(global_config) @auth_managers = {} http_client_config = global_config.client_configuration %w[BasicAuth].each { |auth| @auth_managers[auth] = nil } @auth_managers['BasicAuth'] = BasicAuth.new(http_client_config.basic_auth_credentials) end |
#insights ⇒ InsightsController
Access to insights controller.
74 75 76 |
# File 'lib/advanced_billing/client.rb', line 74 def insights @insights ||= InsightsController.new @global_configuration end |
#invoices ⇒ InvoicesController
Access to invoices controller.
80 81 82 |
# File 'lib/advanced_billing/client.rb', line 80 def invoices @invoices ||= InvoicesController.new @global_configuration end |
#offers ⇒ OffersController
Access to offers controller.
86 87 88 |
# File 'lib/advanced_billing/client.rb', line 86 def offers @offers ||= OffersController.new @global_configuration end |
#payment_profiles ⇒ PaymentProfilesController
Access to payment_profiles controller.
92 93 94 |
# File 'lib/advanced_billing/client.rb', line 92 def payment_profiles @payment_profiles ||= PaymentProfilesController.new @global_configuration end |
#product_families ⇒ ProductFamiliesController
Access to product_families controller.
98 99 100 |
# File 'lib/advanced_billing/client.rb', line 98 def product_families @product_families ||= ProductFamiliesController.new @global_configuration end |
#product_price_points ⇒ ProductPricePointsController
Access to product_price_points controller.
110 111 112 |
# File 'lib/advanced_billing/client.rb', line 110 def product_price_points @product_price_points ||= ProductPricePointsController.new @global_configuration end |
#products ⇒ ProductsController
Access to products controller.
104 105 106 |
# File 'lib/advanced_billing/client.rb', line 104 def products @products ||= ProductsController.new @global_configuration end |
#proforma_invoices ⇒ ProformaInvoicesController
Access to proforma_invoices controller.
116 117 118 |
# File 'lib/advanced_billing/client.rb', line 116 def proforma_invoices @proforma_invoices ||= ProformaInvoicesController.new @global_configuration end |
#reason_codes ⇒ ReasonCodesController
Access to reason_codes controller.
122 123 124 |
# File 'lib/advanced_billing/client.rb', line 122 def reason_codes @reason_codes ||= ReasonCodesController.new @global_configuration end |
#referral_codes ⇒ ReferralCodesController
Access to referral_codes controller.
128 129 130 |
# File 'lib/advanced_billing/client.rb', line 128 def referral_codes @referral_codes ||= ReferralCodesController.new @global_configuration end |
#sales_commissions ⇒ SalesCommissionsController
Access to sales_commissions controller.
134 135 136 |
# File 'lib/advanced_billing/client.rb', line 134 def sales_commissions @sales_commissions ||= SalesCommissionsController.new @global_configuration end |
#sites ⇒ SitesController
Access to sites controller.
140 141 142 |
# File 'lib/advanced_billing/client.rb', line 140 def sites @sites ||= SitesController.new @global_configuration end |
#subscription_components ⇒ SubscriptionComponentsController
Access to subscription_components controller.
152 153 154 |
# File 'lib/advanced_billing/client.rb', line 152 def subscription_components @subscription_components ||= SubscriptionComponentsController.new @global_configuration end |
#subscription_group_invoice_account ⇒ SubscriptionGroupInvoiceAccountController
Access to subscription_group_invoice_account controller.
164 165 166 |
# File 'lib/advanced_billing/client.rb', line 164 def subscription_group_invoice_account @subscription_group_invoice_account ||= SubscriptionGroupInvoiceAccountController.new @global_configuration end |
#subscription_group_status ⇒ SubscriptionGroupStatusController
Access to subscription_group_status controller.
170 171 172 |
# File 'lib/advanced_billing/client.rb', line 170 def subscription_group_status @subscription_group_status ||= SubscriptionGroupStatusController.new @global_configuration end |
#subscription_groups ⇒ SubscriptionGroupsController
Access to subscription_groups controller.
158 159 160 |
# File 'lib/advanced_billing/client.rb', line 158 def subscription_groups @subscription_groups ||= SubscriptionGroupsController.new @global_configuration end |
#subscription_invoice_account ⇒ SubscriptionInvoiceAccountController
Access to subscription_invoice_account controller.
176 177 178 |
# File 'lib/advanced_billing/client.rb', line 176 def subscription_invoice_account @subscription_invoice_account ||= SubscriptionInvoiceAccountController.new @global_configuration end |
#subscription_notes ⇒ SubscriptionNotesController
Access to subscription_notes controller.
182 183 184 |
# File 'lib/advanced_billing/client.rb', line 182 def subscription_notes @subscription_notes ||= SubscriptionNotesController.new @global_configuration end |
#subscription_products ⇒ SubscriptionProductsController
Access to subscription_products controller.
188 189 190 |
# File 'lib/advanced_billing/client.rb', line 188 def subscription_products @subscription_products ||= SubscriptionProductsController.new @global_configuration end |
#subscription_status ⇒ SubscriptionStatusController
Access to subscription_status controller.
194 195 196 |
# File 'lib/advanced_billing/client.rb', line 194 def subscription_status @subscription_status ||= SubscriptionStatusController.new @global_configuration end |
#subscriptions ⇒ SubscriptionsController
Access to subscriptions controller.
146 147 148 |
# File 'lib/advanced_billing/client.rb', line 146 def subscriptions @subscriptions ||= SubscriptionsController.new @global_configuration end |
#webhooks ⇒ WebhooksController
Access to webhooks controller.
200 201 202 |
# File 'lib/advanced_billing/client.rb', line 200 def webhooks @webhooks ||= WebhooksController.new @global_configuration end |