Sha256: 6001792425a01bf884b7655d8615b36191c2334cf96660fe991a09757141b1fa
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
require 'oi_api/version' require 'pry' module OiApi module Configuration VALID_CONFIG_KEYS = [ :username, :password, :api_endpoint, :user_agent, :format, :content_type, :debug_output ] DEFAULT_API_ENDPOINT = 'https://oiapi.com/v1/'.freeze DEFAULT_USER_AGENT = "OiApiRuby Gem #{OiApi::VERSION}".freeze DEFAULT_FORMAT = :json DEFAULT_CONTENT_TYPE = 'application/json' DEFAULT_DEBUG_OUTPUT = false # $stdout attr_accessor *VALID_CONFIG_KEYS def configure yield self end def self.extended(base) base.reset end def options Hash[ *VALID_CONFIG_KEYS.map { |key| [key, public_send(key)] }.flatten ] end def reset self.username = nil self.password = nil self.api_endpoint = DEFAULT_API_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.format = DEFAULT_FORMAT self.content_type = DEFAULT_CONTENT_TYPE self.debug_output = DEFAULT_DEBUG_OUTPUT end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oi-api-ruby-0.1.2 | lib/oi_api/configuration.rb |
oi-api-ruby-0.1.1 | lib/oi_api/configuration.rb |