Class: Txgh::Config::ConfigPair
- Inherits:
-
Object
- Object
- Txgh::Config::ConfigPair
- Defined in:
- lib/txgh/config/config_pair.rb
Instance Attribute Summary collapse
-
#project_config ⇒ Object
readonly
Returns the value of attribute project_config.
-
#repo_config ⇒ Object
readonly
Returns the value of attribute repo_config.
Instance Method Summary collapse
- #git_repo ⇒ Object
- #github_api ⇒ Object
- #gitlab_api ⇒ Object
-
#initialize(project_config, repo_config) ⇒ ConfigPair
constructor
A new instance of ConfigPair.
- #transifex_api ⇒ Object
- #transifex_project ⇒ Object
Constructor Details
#initialize(project_config, repo_config) ⇒ ConfigPair
Returns a new instance of ConfigPair.
6 7 8 9 |
# File 'lib/txgh/config/config_pair.rb', line 6 def initialize(project_config, repo_config) @project_config = project_config @repo_config = repo_config end |
Instance Attribute Details
#project_config ⇒ Object (readonly)
Returns the value of attribute project_config.
4 5 6 |
# File 'lib/txgh/config/config_pair.rb', line 4 def project_config @project_config end |
#repo_config ⇒ Object (readonly)
Returns the value of attribute repo_config.
4 5 6 |
# File 'lib/txgh/config/config_pair.rb', line 4 def repo_config @repo_config end |
Instance Method Details
#git_repo ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/txgh/config/config_pair.rb', line 11 def git_repo @git_repo ||= if @repo_config['git_repo_source'] == 'gitlab' Txgh::GitlabRepo.new(repo_config, gitlab_api) else Txgh::GithubRepo.new(repo_config, github_api) end end |
#github_api ⇒ Object
31 32 33 34 35 |
# File 'lib/txgh/config/config_pair.rb', line 31 def github_api @github_api ||= Txgh::GithubApi.create_from_credentials( repo_config['api_username'], repo_config['api_token'], repo_config['name'] ) end |
#gitlab_api ⇒ Object
37 38 39 40 41 |
# File 'lib/txgh/config/config_pair.rb', line 37 def gitlab_api @gitlab_api ||= Txgh::GitlabApi.create_from_credentials( nil, repo_config['api_token'], repo_config['name'] ) end |
#transifex_api ⇒ Object
25 26 27 28 29 |
# File 'lib/txgh/config/config_pair.rb', line 25 def transifex_api @transifex_api ||= Txgh::TransifexApi.create_from_credentials( project_config['api_username'], project_config['api_password'] ) end |
#transifex_project ⇒ Object
19 20 21 22 23 |
# File 'lib/txgh/config/config_pair.rb', line 19 def transifex_project @transifex_project ||= Txgh::TransifexProject.new( project_config, transifex_api ) end |