module ReamazeAPI
Constants
- Config
Public: Configuration class
- VERSION
Public Class Methods
config() { |config| ... }
click to toggle source
new(**credentials, &block)
click to toggle source
Public: Initializes a new API Client
instance.
**credentials - Credentials used with the Reamaze API (optional)
:brand - Brand name (subdomain from your Reamaze URL) :login - Reamaze login :token - Reamaze API token
block - Optional block that yields a Faraday::Connection instance
(for customizing middleware, headers, etc)
The credentials passed to the API can be configured globally via `ReamazeAPI.config` or passed to this method. Credentials passed directly to this method take precedence over those configured globally.
Raises ArgumentError if a brand, login or token cannot be found.
Returns a ReamazeAPI::Client
instance.
# File lib/reamaze_api.rb, line 44 def self.new(**credentials, &block) params = { brand: credentials.fetch(:brand) { config.brand }, login: credentials.fetch(:login) { config.login }, token: credentials.fetch(:token) { config.token }, } Client.new(**params, &block) end