Class: Glass::ApiKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/glass/api_keys.rb

Overview

just a small class to organize the api key logic info from the yml file in config.

Defined Under Namespace

Classes: APIKeyConfigurationError, YAMLDoesNotHaveTheRightKeysForExtraction

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApiKeys

Returns a new instance of ApiKeys.



9
10
11
12
13
14
15
# File 'lib/glass/api_keys.rb', line 9

def initialize
  self.google_api_keys = {}
  preload_yaml_file_keys
  load_google_keys_from_whereever
  load_keys
  return self.keys
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



8
9
10
# File 'lib/glass/api_keys.rb', line 8

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



8
9
10
# File 'lib/glass/api_keys.rb', line 8

def client_secret
  @client_secret
end

#google_api_keysObject

Returns the value of attribute google_api_keys.



8
9
10
# File 'lib/glass/api_keys.rb', line 8

def google_api_keys
  @google_api_keys
end

#keysObject

Returns the value of attribute keys.



8
9
10
# File 'lib/glass/api_keys.rb', line 8

def keys
  @keys
end

#yaml_configObject

Returns the value of attribute yaml_config.



8
9
10
# File 'lib/glass/api_keys.rb', line 8

def yaml_config
  @yaml_config
end

#yaml_file_contentsObject

Returns the value of attribute yaml_file_contents.



8
9
10
# File 'lib/glass/api_keys.rb', line 8

def yaml_file_contents
  @yaml_file_contents
end

Class Method Details

.generate!Object



16
17
18
19
20
21
22
# File 'lib/glass/api_keys.rb', line 16

def self.generate!
  keys_instance = self.new
  keys_instance.keys
  ::Glass.client_secret = keys_instance.keys.client_secret
  ::Glass.client_id = keys_instance.keys.client_id
  ::Glass._api_keys = keys_instance.keys
end