Sha256: cdd75167cb6f6007683adb4f6c4f678b6541d5892d490d3f089ab4714c028c7f
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
module Yammer module Configurable ENDPOINT = 'https://www.yammer.com' unless defined? ENDPOINT HTTP_CONNECTION = Yammer::HttpConnection unless defined? HTTP_CONNECTION attr_accessor :hostname, :client_id, :client_secret, :access_token, :site_url, :http_adapter, :connection_options # Return a hash with the default options # @return [Hash] def self.default_options { :site_url => ENDPOINT, :client_id => ENV['YAMMER_CLIENT_ID'], :client_secret => ENV['YAMMER_CLIENT_SECRET'], :access_token => ENV['YAMMER_ACCESS_TOKEN'], :http_adapter => HTTP_CONNECTION, :connection_options => { :max_redirects => 5, :use_ssl => true } } end # @return [Array<String> def self.keys Yammer::Configurable.default_options.keys end # @return [Hash] def options Hash[Yammer::Configurable.keys.map{|key| [key, instance_variable_get(:"@#{key}")]}] end def reset! Yammer::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Yammer::Configurable.default_options[key.to_sym]) end self end # Convenience method to allow configuration options to be set in a block def configure yield self self end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
yammer-client-0.1.2 | lib/yammer/configurable.rb |
yammer-client-0.1.1 | lib/yammer/configurable.rb |
yammer-client-0.1.0 | lib/yammer/configurable.rb |