Class: Lhj::YapiTokenConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/lhj/helper/yapi/yapi_token_config.rb

Overview

yapi token Config

Constant Summary collapse

CONFIG_NAME =
'yapi_token_config.yml'

Class Method Summary collapse

Class Method Details

.base_urlObject



22
23
24
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 22

def self.base_url
  config['base_url']
end

.cleanObject



18
19
20
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 18

def self.clean
  @yaml = nil
end

.configObject



14
15
16
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 14

def self.config
  @yaml ||= YAML.load_file(config_file)
end

.config_fileObject



10
11
12
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 10

def self.config_file
  File.join(Lhj::Config.instance.home_dir, CONFIG_NAME)
end

.name(project_id) ⇒ Object



35
36
37
38
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 35

def self.name(project_id)
  c = config['projects'].find { |i| i['project'] == project_id }
  return c['name'] if c
end

.token(project_id) ⇒ Object



30
31
32
33
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 30

def self.token(project_id)
  c = config['projects'].find { |i| i['project'] == project_id }
  return c['token'] if c
end

.webhookObject



26
27
28
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 26

def self.webhook
  config['webhook']
end