lib/voltos.rb in voltos-0.0.8 vs lib/voltos.rb in voltos-0.0.9

- old
+ new

@@ -16,30 +16,34 @@ def self.foobar puts "API key is: #{Voltos.configuration.api_key}" end def self.load - env_str = Curl.get("https://voltos.online/v1/credentials") do |http| + json_str = Curl.get("https://voltos.online/v1/credentials") do |http| http.headers["Authorization"] = "Token token=#{Voltos.configuration.api_key}" end - Voltos.configuration.envs = JSON.parse(env_str.body_str) + Voltos.configuration.json_creds = JSON.parse(json_str.body_str) + Voltos.configuration.status = Voltos.configuration.json_creds["status"] + Voltos.configuration.message = Voltos.configuration.json_creds["message"] end def self.keys - Voltos.configuration.envs.keys + Voltos.configuration.json_creds.keys end - def self.key(bundle, env_key) - if not bundle == "" - Voltos.configuration.envs["bundles"][bundle][env_key] + def self.key(bundle_name, env_key) + if not bundle_name.empty? + Voltos.configuration.json_creds["data"]["bundles"][bundle_name][env_key] else - Voltos.configuration.envs["unbundled"][env_key] + Voltos.configuration.json_creds["data"]["unbundled"][env_key] end end class Configuration attr_accessor :api_key - attr_accessor :envs + attr_accessor :json_creds + attr_accessor :status + attr_accessor :message def initialize @api_key = "" end end