Module: SynsbasenApi

Defined in:
lib/synsbasen_api.rb,
lib/synsbasen_api/error.rb,
lib/synsbasen_api/client.rb,
lib/synsbasen_api/version.rb,
lib/synsbasen_api/findable.rb,
lib/synsbasen_api/resource.rb,
lib/synsbasen_api/searchable.rb,
lib/synsbasen_api/api_response.rb,
lib/synsbasen_api/resources/brand.rb,
lib/synsbasen_api/resources/model.rb,
lib/synsbasen_api/resources/variant.rb,
lib/synsbasen_api/resources/vehicle.rb,
lib/synsbasen_api/resources/version.rb,
lib/synsbasen_api/resources/error_code.rb,
lib/synsbasen_api/resources/inspection.rb,
lib/synsbasen_api/resources/test_center.rb,
lib/synsbasen_api/resources/leasing_period.rb,
lib/synsbasen_api/resources/watched_vehicle.rb

Overview

The SynsbasenApi module provides a configuration mechanism and requires various classes and modules related to interacting with the Synsbasen API.

Defined Under Namespace

Modules: Findable, Searchable Classes: ApiResponse, Brand, Client, ClientError, Error, ErrorCode, Inspection, LeasingPeriod, Model, Resource, ServerError, TestCenter, Variant, Vehicle, Version, WatchedVehicle

Constant Summary collapse

REQUIRED_CONFIGS =

An array of required configuration keys.

%i[api_key]
VERSION =

The VERSION module specifies the version of the SynsbasenApi gem.

"1.0.10"

Class Method Summary collapse

Class Method Details

.configOpenStruct

Retrieves the current configuration or configures the Synsbasen API client with default options.

Returns:

  • (OpenStruct)

    The configuration object.



40
41
42
# File 'lib/synsbasen_api.rb', line 40

def self.config
  @config || configure
end

.configure {|config| ... } ⇒ Object

Configures the Synsbasen API client with the specified options.

Yield Parameters:

  • config (OpenStruct)

    The configuration object.



28
29
30
31
32
33
34
35
# File 'lib/synsbasen_api.rb', line 28

def self.configure
  @config ||= OpenStruct.new
  yield(@config) if block_given?

  raise "Missing configuration. Required configurations are #{REQUIRED_CONFIGS}" unless REQUIRED_CONFIGS.all? { |c| @config[c] }

  @config
end