Class: StickyIoRestfulApiV2025731::Client

Inherits:
Object
  • Object
show all
Includes:
CoreLibrary
Defined in:
lib/sticky_io_restful_api_v2025731/client.rb

Overview

sticky_io_restful_api_v2025731 client class.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection: nil, adapter: :net_http_persistent, timeout: 60, 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, proxy_settings: nil, logging_configuration: nil, environment: Environment::PRODUCTION, basic_credentials: nil, bearer_credentials: nil, config: nil) ⇒ Client

Returns a new instance of Client.



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 298

def initialize(
  connection: nil, adapter: :net_http_persistent, timeout: 60,
  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, proxy_settings: nil,
  logging_configuration: nil, environment: Environment::PRODUCTION,
  basic_credentials: nil, bearer_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,
                proxy_settings: proxy_settings,
                logging_configuration: logging_configuration,
                environment: environment,
                basic_credentials: basic_credentials,
                bearer_credentials: bearer_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_managersObject (readonly)

Returns the value of attribute auth_managers.



10
11
12
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 10

def auth_managers
  @auth_managers
end

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 10

def config
  @config
end

Class Method Details

.from_env(**overrides) ⇒ Object

Creates a client directly from environment variables.



345
346
347
348
349
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 345

def self.from_env(**overrides)
  default_config = Configuration.build_default_config_from_env
  new_config = default_config.clone_with(**overrides)
  new(config: new_config)
end

Instance Method Details

#addressesAddressesController

Access to addresses controller.

Returns:



48
49
50
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 48

def addresses
  @addresses ||= AddressesController.new @global_configuration
end

#affiliatesAffiliatesController

Access to affiliates controller.

Returns:



24
25
26
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 24

def affiliates
  @affiliates ||= AffiliatesController.new @global_configuration
end

#attributesAttributesController

Access to attributes controller.

Returns:



204
205
206
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 204

def attributes
  @attributes ||= AttributesController.new @global_configuration
end

#billing_modelsBillingModelsController

Access to billing_models controller.

Returns:



36
37
38
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 36

def billing_models
  @billing_models ||= BillingModelsController.new @global_configuration
end

#campaignsCampaignsController

Access to campaigns controller.

Returns:



42
43
44
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 42

def campaigns
  @campaigns ||= CampaignsController.new @global_configuration
end

#categoriesCategoriesController

Access to categories controller.

Returns:



210
211
212
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 210

def categories
  @categories ||= CategoriesController.new @global_configuration
end

#chargebackChargebackController

Access to chargeback controller.

Returns:



246
247
248
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 246

def chargeback
  @chargeback ||= ChargebackController.new @global_configuration
end

#communicationsCommunicationsController

Access to communications controller.

Returns:



72
73
74
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 72

def communications
  @communications ||= CommunicationsController.new @global_configuration
end

#configurationsConfigurationsController

Access to configurations controller.

Returns:



192
193
194
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 192

def configurations
  @configurations ||= ConfigurationsController.new @global_configuration
end

#contactsContactsController

Access to contacts controller.

Returns:



78
79
80
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 78

def contacts
  @contacts ||= ContactsController.new @global_configuration
end

#couponsCouponsController

Access to coupons controller.

Returns:



90
91
92
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 90

def coupons
  @coupons ||= CouponsController.new @global_configuration
end

#creditsCreditsController

Access to credits controller.

Returns:



156
157
158
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 156

def credits
  @credits ||= CreditsController.new @global_configuration
end

#custom_fieldsCustomFieldsController

Access to custom_fields controller.

Returns:



96
97
98
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 96

def custom_fields
  @custom_fields ||= CustomFieldsController.new @global_configuration
end

#customersCustomersController

Access to customers controller.

Returns:



102
103
104
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 102

def customers
  @customers ||= CustomersController.new @global_configuration
end

#discountDiscountController

Access to discount controller.

Returns:



150
151
152
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 150

def discount
  @discount ||= DiscountController.new @global_configuration
end

#gatewaysGatewaysController

Access to gateways controller.

Returns:



108
109
110
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 108

def gateways
  @gateways ||= GatewaysController.new @global_configuration
end

#imagesImagesController

Access to images controller.

Returns:



114
115
116
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 114

def images
  @images ||= ImagesController.new @global_configuration
end

#initialize_auth_managers(global_config) ⇒ Object

Initializes the auth managers hash used for authenticating API calls.

Parameters:

  • global_config (GlobalConfiguration)

    The global configuration of the SDK)



336
337
338
339
340
341
342
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 336

def initialize_auth_managers(global_config)
  @auth_managers = {}
  http_client_config = global_config.client_configuration
  %w[basic bearer].each { |auth| @auth_managers[auth] = nil }
  @auth_managers['basic'] = Basic.new(http_client_config.basic_credentials)
  @auth_managers['bearer'] = Bearer.new(http_client_config.bearer_credentials)
end

#interestsInterestsController

Access to interests controller.

Returns:



66
67
68
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 66

def interests
  @interests ||= InterestsController.new @global_configuration
end

#inventoriesInventoriesController

Access to inventories controller.

Returns:



258
259
260
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 258

def inventories
  @inventories ||= InventoriesController.new @global_configuration
end

#line_item_custom_optionsLineItemCustomOptionsController

Access to line_item_custom_options controller.

Returns:



168
169
170
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 168

def line_item_custom_options
  @line_item_custom_options ||= LineItemCustomOptionsController.new @global_configuration
end

#line_item_managementLineItemManagementController

Access to line_item_management controller.

Returns:



174
175
176
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 174

def line_item_management
  @line_item_management ||= LineItemManagementController.new @global_configuration
end

#metaMetaController

Access to meta controller.

Returns:



30
31
32
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 30

def meta
  @meta ||= MetaController.new @global_configuration
end

#miscMiscController

Access to misc controller.

Returns:



294
295
296
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 294

def misc
  @misc ||= MiscController.new @global_configuration
end

#notesNotesController

Access to notes controller.

Returns:



132
133
134
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 132

def notes
  @notes ||= NotesController.new @global_configuration
end

#offersOffersController

Access to offers controller.

Returns:



198
199
200
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 198

def offers
  @offers ||= OffersController.new @global_configuration
end

#orderOrderController

Access to order controller.

Returns:



270
271
272
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 270

def order
  @order ||= OrderController.new @global_configuration
end

#ordersOrdersController

Access to orders controller.

Returns:



186
187
188
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 186

def orders
  @orders ||= OrdersController.new @global_configuration
end

#overridesOverridesController

Access to overrides controller.

Returns:



162
163
164
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 162

def overrides
  @overrides ||= OverridesController.new @global_configuration
end

#payment_routerPaymentRouterController

Access to payment_router controller.

Returns:



282
283
284
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 282

def payment_router
  @payment_router ||= PaymentRouterController.new @global_configuration
end

#payment_types_methodsPaymentTypesMethodsController

Access to payment_types_methods controller.

Returns:



54
55
56
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 54

def payment_types_methods
  @payment_types_methods ||= PaymentTypesMethodsController.new @global_configuration
end

#permissionsPermissionsController

Access to permissions controller.

Returns:



18
19
20
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 18

def permissions
  @permissions ||= PermissionsController.new @global_configuration
end

#productsProductsController

Access to products controller.

Returns:



144
145
146
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 144

def products
  @products ||= ProductsController.new @global_configuration
end

#promo_codesPromoCodesController

Access to promo_codes controller.

Returns:



84
85
86
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 84

def promo_codes
  @promo_codes ||= PromoCodesController.new @global_configuration
end

#prospectsProspectsController

Access to prospects controller.

Returns:



222
223
224
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 222

def prospects
  @prospects ||= ProspectsController.new @global_configuration
end

#shippingShippingController

Access to shipping controller.

Returns:



228
229
230
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 228

def shipping
  @shipping ||= ShippingController.new @global_configuration
end

#start_stop_resetStartStopResetController

Access to start_stop_reset controller.

Returns:



138
139
140
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 138

def start_stop_reset
  @start_stop_reset ||= StartStopResetController.new @global_configuration
end

#subscriptionSubscriptionController

Access to subscription controller.

Returns:



276
277
278
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 276

def subscription
  @subscription ||= SubscriptionController.new @global_configuration
end

#subscriptionsSubscriptionsController

Access to subscriptions controller.

Returns:



180
181
182
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 180

def subscriptions
  @subscriptions ||= SubscriptionsController.new @global_configuration
end

#templatesTemplatesController

Access to templates controller.

Returns:



126
127
128
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 126

def templates
  @templates ||= TemplatesController.new @global_configuration
end

#tokenizationTokenizationController

Access to tokenization controller.

Returns:



234
235
236
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 234

def tokenization
  @tokenization ||= TokenizationController.new @global_configuration
end

#trial_workflowsTrialWorkflowsController

Access to trial_workflows controller.

Returns:



252
253
254
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 252

def trial_workflows
  @trial_workflows ||= TrialWorkflowsController.new @global_configuration
end

#typesTypesController

Access to types controller.

Returns:



120
121
122
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 120

def types
  @types ||= TypesController.new @global_configuration
end

#user_agent_detailObject



12
13
14
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 12

def user_agent_detail
  config.user_agent_detail
end

#usersUsersController

Access to users controller.

Returns:



240
241
242
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 240

def users
  @users ||= UsersController.new @global_configuration
end

#variantsVariantsController

Access to variants controller.

Returns:



216
217
218
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 216

def variants
  @variants ||= VariantsController.new @global_configuration
end

#volume_discountsVolumeDiscountsController

Access to volume_discounts controller.

Returns:



288
289
290
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 288

def volume_discounts
  @volume_discounts ||= VolumeDiscountsController.new @global_configuration
end

#walletWalletController

Access to wallet controller.

Returns:



60
61
62
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 60

def wallet
  @wallet ||= WalletController.new @global_configuration
end

#warehouseWarehouseController

Access to warehouse controller.

Returns:



264
265
266
# File 'lib/sticky_io_restful_api_v2025731/client.rb', line 264

def warehouse
  @warehouse ||= WarehouseController.new @global_configuration
end