Method: Skykick::API#initialize

Defined in:
lib/skykick/api.rb

#initialize(options = {}) ⇒ Skykick::API

Initializes a new ‘Skykick::API` instance with the given options. The options are merged with the global Skykick settings to allow both global and per-instance customization.

Examples:

Create a new API instance with custom options:

api = Skykick::API.new(endpoint: "https://custom-api.endpoint.com", user_agent: "MyApp UA/1.0")

Parameters:

  • options (Hash) (defaults to: {})

    A hash of configuration options. These options can override the global Skykick configuration.



25
26
27
28
29
30
31
32
33
# File 'lib/skykick/api.rb', line 25

def initialize(options = {})
  # Merge the provided options with the global Skykick configuration.
  options = Skykick.options.merge(options)

  # Set each configuration key dynamically using the merged options.
  WrAPI::Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", options[key])
  end
end