Class: Geoloqi::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/geoloqi/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Config

Returns a new instance of Config.

Raises:



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/geoloqi/config.rb', line 4

def initialize(opts={})
  self.enable_logging ||= false
  self.use_hashie_mash ||= false
  self.throw_exceptions ||= true
  opts.each {|k,v| send("#{k}=", v)}
  begin
    require 'hashie' if self.use_hashie_mash && !defined?(Hashie::Mash)
  rescue LoadError
    raise Error, "You've requested Hashie::Mash, but the gem is not available. Don't set use_hashie_mash in your config, or install the hashie gem"
  end
  raise ArgumentError, 'enable_logging must be boolean' unless [true, false].include? self.enable_logging
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



3
4
5
# File 'lib/geoloqi/config.rb', line 3

def adapter
  @adapter
end

#client_idObject

Returns the value of attribute client_id.



3
4
5
# File 'lib/geoloqi/config.rb', line 3

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



3
4
5
# File 'lib/geoloqi/config.rb', line 3

def client_secret
  @client_secret
end

#enable_loggingObject

Returns the value of attribute enable_logging.



3
4
5
# File 'lib/geoloqi/config.rb', line 3

def enable_logging
  @enable_logging
end

#redirect_uriObject

Returns the value of attribute redirect_uri.



3
4
5
# File 'lib/geoloqi/config.rb', line 3

def redirect_uri
  @redirect_uri
end

#throw_exceptionsObject

Returns the value of attribute throw_exceptions.



3
4
5
# File 'lib/geoloqi/config.rb', line 3

def throw_exceptions
  @throw_exceptions
end

#use_hashie_mashObject

Returns the value of attribute use_hashie_mash.



3
4
5
# File 'lib/geoloqi/config.rb', line 3

def use_hashie_mash
  @use_hashie_mash
end

Instance Method Details

#client_id?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/geoloqi/config.rb', line 17

def client_id?
  !client_id.nil? && !client_id.empty?
end

#client_secret?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/geoloqi/config.rb', line 21

def client_secret?
  !client_secret.nil? && !client_secret.empty?
end