Sha256: 15675cb60dc9d55b44f5279309007329936ff5bffddd7d3acf537c64bd99d104
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
module Teachable module Jg module Configuration VALID_CONNECTION_KEYS = [:method, :authorization_message, :authorized].freeze VALID_OPTIONS_KEYS = [:format].freeze VALID_CONFIG_KEYS = VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS DEFAULT_ENDPOINT = 'http://secure.localhost.com:3000/users' DEFAULT_METHOD = :post DEFAULT_USER_AGENT = "Teachable API Ruby Gem #{Teachable::Jg::VERSION}".freeze DEFAULT_FORMAT = :json DEFAULT_AUTHORIZED = false DEFAULT_AUTHORIZATION_MESSAGE = "" # Build accessor methods for every config options so we can do this, for example: # Teachable::Jg.format = :xml attr_accessor *VALID_CONFIG_KEYS # Make sure we have the default values set when we get 'extended' def self.extended(base) base.reset end def options Hash[ * VALID_CONFIG_KEYS.map do |key| self.reset [key, send(key)] end.flatten ] end def reset self.method = DEFAULT_METHOD self.format = DEFAULT_FORMAT self.authorized = DEFAULT_AUTHORIZED self.authorization_message = DEFAULT_AUTHORIZATION_MESSAGE end def configure yield self end end # Configuration end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
teachable-jg-0.0.3 | lib/teachable/jg/configuration.rb |