Class: InchCI::AccessToken

Inherits:
Object
  • Object
show all
Defined in:
lib/inch_ci/access_token.rb

Overview

Manages access tokens for GitHub et al.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ AccessToken

Returns a new instance of AccessToken.


4
5
6
# File 'lib/inch_ci/access_token.rb', line 4

def initialize(path)
  @hash = load_yaml(path) || {}
end

Class Method Details

.[](service) ⇒ Object

Returns an access token for the given service


22
23
24
# File 'lib/inch_ci/access_token.rb', line 22

def [](service)
  all[service.to_s]
end

.allHash

Returns all access tokens.

Returns:

  • (Hash)

    all access tokens


27
28
29
# File 'lib/inch_ci/access_token.rb', line 27

def all
  @all ||= new(File.join("config", "access_tokens.yml"))
end

Instance Method Details

#[](key) ⇒ Object


8
9
10
# File 'lib/inch_ci/access_token.rb', line 8

def [](key)
  @hash[key.to_s]
end