Class: LgPodPlugin::LConfig
- Inherits:
-
Object
- Object
- LgPodPlugin::LConfig
- Defined in:
- lib/lg_pod_plugin/config/l_config.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#host ⇒ Object
Returns the value of attribute host.
-
#project ⇒ Object
Returns the value of attribute project.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ LConfig
constructor
A new instance of LConfig.
Constructor Details
#initialize ⇒ LConfig
Returns a new instance of LConfig.
15 16 |
# File 'lib/lg_pod_plugin/config/l_config.rb', line 15 def initialize end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
11 12 13 |
# File 'lib/lg_pod_plugin/config/l_config.rb', line 11 def access_token @access_token end |
#base_url ⇒ Object
Returns the value of attribute base_url.
9 10 11 |
# File 'lib/lg_pod_plugin/config/l_config.rb', line 9 def base_url @base_url end |
#host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/lg_pod_plugin/config/l_config.rb', line 8 def host @host end |
#project ⇒ Object
Returns the value of attribute project.
13 14 15 |
# File 'lib/lg_pod_plugin/config/l_config.rb', line 13 def project @project end |
#project_name ⇒ Object
Returns the value of attribute project_name.
10 11 12 |
# File 'lib/lg_pod_plugin/config/l_config.rb', line 10 def project_name @project_name end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
12 13 14 |
# File 'lib/lg_pod_plugin/config/l_config.rb', line 12 def refresh_token @refresh_token end |
Class Method Details
.get_config(git, uri) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lg_pod_plugin/config/l_config.rb', line 19 def self.get_config(git, uri) return nil unless uri&.hostname return nil unless LUtils.is_gitlab_uri(git, uri.hostname) user_id = LUserAuthInfo.get_user_id(uri.hostname) user_info = LSqliteDb.shared.query_user_info(user_id) if user_info != nil user_info = GitLabAPI.check_gitlab_access_token_valid(uri, user_info) else user_info = GitLabAPI.get_gitlab_access_token(uri, user_id) end return nil unless user_info config = LConfig.new config.host = uri.hostname config.access_token = user_info.access_token config.refresh_token = user_info.refresh_token config.base_url = LUtils.get_gitlab_base_url(git) config.project_name = LUtils.get_git_project_name(git) config.project = LSqliteDb.shared.query_project_info(config.project_name, git) unless config.project config.project = GitLabAPI.request_project_info(config.host, config.project_name, config.access_token, git) end return config end |