Class: Unfuddle::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/unfuddle/configuration.rb

Defined Under Namespace

Classes: Logger

Instance Method Summary collapse

Instance Method Details

#from_options(options) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/unfuddle/configuration.rb', line 37

def from_options(options)
  options = options.with_indifferent_access
  self.subdomain             = options[:subdomain]             if options.key?(:subdomain)
  self.username              = options[:username]              if options.key?(:username)
  self.password              = options[:password]              if options.key?(:password)
  self.include_associations  = options[:include_associations]  if options.key?(:include_associations)
  self.include_closed_on     = options[:include_closed_on]     if options.key?(:include_closed_on)
  self.timeout               = options.fetch :timeout, 120
  self.logger                = options.fetch :logger, Unfuddle::Configuration::Logger.new
end

#merge(options) ⇒ Object



23
24
25
# File 'lib/unfuddle/configuration.rb', line 23

def merge(options)
  to_h.merge(options)
end

#to_hObject



27
28
29
30
31
32
33
34
35
# File 'lib/unfuddle/configuration.rb', line 27

def to_h
  { subdomain: subdomain,
    username: username,
    password: password,
    include_associations: include_associations,
    include_closed_on: include_closed_on,
    logged: logger,
    timeout: timeout }
end