Class: I28s::Cli::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/i28s/cli.rb

Constant Summary collapse

DEFAULT_BASE_URL =
"https://i28s.dev/api/v1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/i28s/cli.rb', line 22

def initialize
  configuration = begin
    YAML.load_file(File.expand_path(".i28s.yml"))
  rescue Errno::ENOENT
    {}
  end

  @api_key = configuration["api_key"]
  @project_token = configuration["project_token"]
  @base_url = configuration["base_url"] || DEFAULT_BASE_URL
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



18
19
20
# File 'lib/i28s/cli.rb', line 18

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



18
19
20
# File 'lib/i28s/cli.rb', line 18

def base_url
  @base_url
end

#project_tokenObject

Returns the value of attribute project_token.



18
19
20
# File 'lib/i28s/cli.rb', line 18

def project_token
  @project_token
end