Sha256: 6a521b0ae4c2d4ef20dadfe50bb8dfd3a3dcbf2c9efa219121e9adf1f69892e5
Contents?: true
Size: 935 Bytes
Versions: 2
Compression:
Stored size: 935 Bytes
Contents
require 'faraday' require 'ivapi/version' module Ivapi module Configuration attr_accessor :server_id, :user_agent, :connection_options, :web_endpoint, :api_endpoint attr_writer :username, :password def self.keys @keys ||= [ :api_endpoint, :server_id, :username, :middleware, :password, :user_agent, :connection_options ] end def configure yield self end # Reset configuration options to default values def reset! Ivapi::Configuration.keys.each do |key| instance_variable_set(:"@#{key}", Ivapi::Default.options[key]) end self end alias setup reset! def configure yield self end private def options Hash[ Ivapi::Configuration.keys.map do |key| [key, instance_variable_get(:"@#{key}")] end ] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ivapi-1.1.1 | lib/ivapi/configuration.rb |
ivapi-1.1.0 | lib/ivapi/configuration.rb |