Class: Txgh::GitStatus
- Inherits:
-
Object
- Object
- Txgh::GitStatus
- Defined in:
- lib/txgh/git_status.rb
Direct Known Subclasses
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
- #error(options = {}) ⇒ Object
-
#initialize(project, repo, branch) ⇒ GitStatus
constructor
A new instance of GitStatus.
- #update ⇒ Object
Constructor Details
#initialize(project, repo, branch) ⇒ GitStatus
Returns a new instance of GitStatus.
36 37 38 39 40 |
# File 'lib/txgh/git_status.rb', line 36 def initialize(project, repo, branch) @project = project @repo = repo @branch = branch end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
34 35 36 |
# File 'lib/txgh/git_status.rb', line 34 def branch @branch end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
34 35 36 |
# File 'lib/txgh/git_status.rb', line 34 def project @project end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
34 35 36 |
# File 'lib/txgh/git_status.rb', line 34 def repo @repo end |
Class Method Details
.error(project, repo, branch, options = {}) ⇒ Object
29 30 31 |
# File 'lib/txgh/git_status.rb', line 29 def error(project, repo, branch, = {}) new(project, repo, branch).error() end |
.update(project, repo, branch) ⇒ Object
25 26 27 |
# File 'lib/txgh/git_status.rb', line 25 def update(project, repo, branch) new(project, repo, branch).update end |
Instance Method Details
#error(options = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/txgh/git_status.rb', line 52 def error( = {}) repo.api.create_status( sha, State.error, { context: context, target_url: .fetch(:target_url), description: .fetch(:description) } ) end |
#update ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/txgh/git_status.rb', line 42 def update return if tx_resources.empty? repo.api.create_status( sha, state, { context: context, target_url: target_url, description: description } ) end |