Class: ErpIntegration::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/erp_integration/configuration.rb

Overview

Use the ‘Configuration` class to configure the ERP Integration gem. Use an initializer in your project configure the ERP Integration gem.

Examples:

```ruby
  # config/initializers/erp_integration.rb
  ErpIntegration.configure do |config|
    config.fulfil_api_keys = "..."
  end
```

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Configuration

Returns a new instance of Configuration.



171
172
173
174
175
# File 'lib/erp_integration/configuration.rb', line 171

def initialize(**options)
  options.each_pair do |key, value|
    public_send("#{key}=", value) if respond_to?("#{key}=")
  end
end

Instance Attribute Details

#api_key_rotation_thresholdObject

The ‘api_key_rotation_threshold` is used by the `ApiKeysRotation` middleware it will rotate the API key when the remaining requests are less than the threshold.

Set the ‘api_key_rotation_threshold` to 0, it you don’t want to rotate by the remaining requests.



29
30
31
# File 'lib/erp_integration/configuration.rb', line 29

def api_key_rotation_threshold
  @api_key_rotation_threshold
end

#bill_of_material_adapterObject



189
190
191
# File 'lib/erp_integration/configuration.rb', line 189

def bill_of_material_adapter
  @bill_of_material_adapter || :fulfil
end

#bill_of_material_input_adapterObject



193
194
195
# File 'lib/erp_integration/configuration.rb', line 193

def bill_of_material_input_adapter
  @bill_of_material_input_adapter || :fulfil
end

#bill_of_material_output_adapterObject



197
198
199
# File 'lib/erp_integration/configuration.rb', line 197

def bill_of_material_output_adapter
  @bill_of_material_output_adapter || :fulfil
end

#channel_listing_adapterObject



209
210
211
# File 'lib/erp_integration/configuration.rb', line 209

def channel_listing_adapter
  @channel_listing_adapter || :fulfil
end

#country_adapterObject



205
206
207
# File 'lib/erp_integration/configuration.rb', line 205

def country_adapter
  @country_adapter || :fulfil
end

#customer_shipment_adapterObject



213
214
215
# File 'lib/erp_integration/configuration.rb', line 213

def customer_shipment_adapter
  @customer_shipment_adapter || :fulfil
end

#customer_shipment_return_adapterObject



217
218
219
# File 'lib/erp_integration/configuration.rb', line 217

def customer_shipment_return_adapter
  @customer_shipment_return_adapter || :fulfil
end

#fulfil_api_keysArray<String>

The ‘fulfil_api_keys` sets a single or a list of API keys to use in the `FulfilClient` to authorize the requests to the Fulfil API endpoints.

Returns:

  • (Array<String>)

    The API keys for Fulfil.



18
19
20
# File 'lib/erp_integration/configuration.rb', line 18

def fulfil_api_keys
  @fulfil_api_keys
end

#fulfil_base_urlString

The ‘fulfil_base_url` is used by the `FulfilClient` to connect to the right Fulfil API endpoints.

Returns:

  • (String)

    The base URL for Fulfil.



23
24
25
# File 'lib/erp_integration/configuration.rb', line 23

def fulfil_base_url
  @fulfil_base_url
end

#gift_card_adapterObject



293
294
295
# File 'lib/erp_integration/configuration.rb', line 293

def gift_card_adapter
  @gift_card_adapter || :fulfil
end

#internal_shipment_adapterObject



221
222
223
# File 'lib/erp_integration/configuration.rb', line 221

def internal_shipment_adapter
  @internal_shipment_adapter || :fulfil
end

#location_adapterObject



225
226
227
# File 'lib/erp_integration/configuration.rb', line 225

def location_adapter
  @location_adapter || :fulfil
end

#party_address_adapterObject



301
302
303
# File 'lib/erp_integration/configuration.rb', line 301

def party_address_adapter
  @party_address_adapter || :fulfil
end

#product_adapterObject



229
230
231
# File 'lib/erp_integration/configuration.rb', line 229

def product_adapter
  @product_adapter || :fulfil
end

#product_category_adapterObject



233
234
235
# File 'lib/erp_integration/configuration.rb', line 233

def product_category_adapter
  @product_category_adapter || :fulfil
end

#product_option_adapterObject



305
306
307
# File 'lib/erp_integration/configuration.rb', line 305

def product_option_adapter
  @product_option_adapter || :fulfil
end

#product_template_adapterObject



237
238
239
# File 'lib/erp_integration/configuration.rb', line 237

def product_template_adapter
  @product_template_adapter || :fulfil
end

#production_order_adapterObject



241
242
243
# File 'lib/erp_integration/configuration.rb', line 241

def production_order_adapter
  @production_order_adapter || :fulfil
end

#purchase_order_adapterObject



245
246
247
# File 'lib/erp_integration/configuration.rb', line 245

def purchase_order_adapter
  @purchase_order_adapter || :fulfil
end

#purchase_order_line_adapterObject



249
250
251
# File 'lib/erp_integration/configuration.rb', line 249

def purchase_order_line_adapter
  @purchase_order_line_adapter || :fulfil
end

#purchase_request_adapterObject



253
254
255
# File 'lib/erp_integration/configuration.rb', line 253

def purchase_request_adapter
  @purchase_request_adapter || :fulfil
end

#sales_line_option_adapterObject



297
298
299
# File 'lib/erp_integration/configuration.rb', line 297

def sales_line_option_adapter
  @sales_line_option_adapter || :fulfil
end

#sales_order_adapterObject



261
262
263
# File 'lib/erp_integration/configuration.rb', line 261

def sales_order_adapter
  @sales_order_adapter || :fulfil
end

#sales_order_line_adapterObject



257
258
259
# File 'lib/erp_integration/configuration.rb', line 257

def sales_order_line_adapter
  @sales_order_line_adapter || :fulfil
end

#sales_return_reason_adapterObject



265
266
267
# File 'lib/erp_integration/configuration.rb', line 265

def sales_return_reason_adapter
  @sales_return_reason_adapter || :fulfil
end

#stock_bin_transfer_adapterObject



273
274
275
# File 'lib/erp_integration/configuration.rb', line 273

def stock_bin_transfer_adapter
  @stock_bin_transfer_adapter || :fulfil
end

#stock_move_adapterObject



277
278
279
# File 'lib/erp_integration/configuration.rb', line 277

def stock_move_adapter
  @stock_move_adapter || :fulfil
end

#supplier_shipment_adapterObject



269
270
271
# File 'lib/erp_integration/configuration.rb', line 269

def supplier_shipment_adapter
  @supplier_shipment_adapter || :fulfil
end

#task_adapterObject



281
282
283
# File 'lib/erp_integration/configuration.rb', line 281

def task_adapter
  @task_adapter || :fulfil
end

#tracking_number_adapterObject



285
286
287
# File 'lib/erp_integration/configuration.rb', line 285

def tracking_number_adapter
  @tracking_number_adapter || :fulfil
end

Instance Method Details

#box_type_adapterObject



201
202
203
# File 'lib/erp_integration/configuration.rb', line 201

def box_type_adapter
  @box_type_adapter || :fulfil
end

#carrier_adapterObject



181
182
183
# File 'lib/erp_integration/configuration.rb', line 181

def carrier_adapter
  @carrier_adapter || :fulfil
end

#carrier_service_adapterObject



185
186
187
# File 'lib/erp_integration/configuration.rb', line 185

def carrier_service_adapter
  @carrier_service_adapter || :fulfil
end

#loggerObject



321
322
323
# File 'lib/erp_integration/configuration.rb', line 321

def logger
  @logger || Logger.new(nil)
end

#logger=(logger) ⇒ Object



325
326
327
# File 'lib/erp_integration/configuration.rb', line 325

def logger=(logger)
  @logger = Logger.new(logger)
end

#rate_limitersObject

Rate limiters that will be used for HTTP operations on Client to manage the number of requests made to avoid rate limiting by the API provider.



311
312
313
# File 'lib/erp_integration/configuration.rb', line 311

def rate_limiters
  @rate_limiters ||= []
end

#rate_limiters=(rate_limiters) ⇒ Object

Sets the rate limiters that will be used

Raises:

  • (MissingMethodError)

    if the rate limiter object doesn’t respond to the required methods.



317
318
319
# File 'lib/erp_integration/configuration.rb', line 317

def rate_limiters=(rate_limiters)
  @rate_limiters = (rate_limiters || []).each { |limiter| RateLimiter.validate!(limiter) }
end

#webhook_adapterObject



289
290
291
# File 'lib/erp_integration/configuration.rb', line 289

def webhook_adapter
  @webhook_adapter || :fulfil
end