Class: Lhj::YapiTokenConfig
- Inherits:
-
Object
- Object
- Lhj::YapiTokenConfig
- 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
- .base_url ⇒ Object
- .clean ⇒ Object
- .config ⇒ Object
- .config_file ⇒ Object
- .name(project_id) ⇒ Object
- .token(project_id) ⇒ Object
- .webhook ⇒ Object
Class Method Details
.base_url ⇒ Object
22 23 24 |
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 22 def self.base_url config['base_url'] end |
.clean ⇒ Object
18 19 20 |
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 18 def self.clean @yaml = nil end |
.config ⇒ Object
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_file ⇒ Object
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 |
.webhook ⇒ Object
26 27 28 |
# File 'lib/lhj/helper/yapi/yapi_token_config.rb', line 26 def self.webhook config['webhook'] end |