Class: Txgh::GithubStatus
- Inherits:
-
Object
- Object
- Txgh::GithubStatus
- Defined in:
- lib/txgh/github_status.rb
Defined Under Namespace
Classes: State
Constant Summary collapse
- ALL_COMPLETE_DESCRIPTION =
"Translations complete!"- TARGET_URL_TEMPLATE =
"https://www.transifex.com/%{organization}/%{project_slug}/content"- DESCRIPTION_TEMPLATE =
"%{complete}/%{total} translations complete."- CONTEXT =
'continuous-localization/txgh'
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(project, repo, branch) ⇒ GithubStatus
constructor
A new instance of GithubStatus.
- #update ⇒ Object
Constructor Details
#initialize(project, repo, branch) ⇒ GithubStatus
Returns a new instance of GithubStatus.
32 33 34 35 36 |
# File 'lib/txgh/github_status.rb', line 32 def initialize(project, repo, branch) @project = project @repo = repo @branch = branch end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
30 31 32 |
# File 'lib/txgh/github_status.rb', line 30 def branch @branch end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
30 31 32 |
# File 'lib/txgh/github_status.rb', line 30 def project @project end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
30 31 32 |
# File 'lib/txgh/github_status.rb', line 30 def repo @repo end |
Class Method Details
.update(project, repo, branch) ⇒ Object
25 26 27 |
# File 'lib/txgh/github_status.rb', line 25 def update(project, repo, branch) new(project, repo, branch).update end |
Instance Method Details
#update ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/txgh/github_status.rb', line 38 def update return if tx_resources.empty? sha = repo.api.get_ref(branch)[:object][:sha] repo.api.create_status( sha, state, { context: context, target_url: target_url, description: description } ) end |