Class: Vertpig::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/vertpig/configuration.rb

Constant Summary collapse

@@defaults =
{
  key: ENV['vertpig_api_key'],
  secret: ENV['vertpig_api_secret']
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
# File 'lib/vertpig/configuration.rb', line 18

def initialize
  reset
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/vertpig/configuration.rb', line 7

def key
  @key
end

#secretObject

Returns the value of attribute secret.



7
8
9
# File 'lib/vertpig/configuration.rb', line 7

def secret
  @secret
end

Class Method Details

.defaultsObject



14
15
16
# File 'lib/vertpig/configuration.rb', line 14

def self.defaults
  @@defaults
end

Instance Method Details

#authObject



22
23
24
25
26
27
# File 'lib/vertpig/configuration.rb', line 22

def auth
  {
    key: key,
    secret: secret
  }
end

#resetObject



29
30
31
# File 'lib/vertpig/configuration.rb', line 29

def reset
  @@defaults.each_pair { |k, v| send("#{k}=", v) }
end