Module: Bitly::Config

Defined in:
lib/providers/bitly/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



5
6
7
# File 'lib/providers/bitly/config.rb', line 5

def api_key
  @api_key
end

.config_fileObject

Returns the value of attribute config_file.



5
6
7
# File 'lib/providers/bitly/config.rb', line 5

def config_file
  @config_file
end

.loginObject

Returns the value of attribute login.



5
6
7
# File 'lib/providers/bitly/config.rb', line 5

def 
  @login
end

Class Method Details

.load_configObject



12
13
14
15
16
17
# File 'lib/providers/bitly/config.rb', line 12

def load_config()
   unless config_file.nil?
     api_details = YAML.load(File.open(config_file)).symbolize_keys 
     @api_key, @login = api_details[:api_key], api_details[:login]
   end
end

.set(&block) ⇒ Object



7
8
9
10
# File 'lib/providers/bitly/config.rb', line 7

def set(&block)
  self.class_eval(&block) if block_given?
  load_config
end