Class: Txgh::GithubStatus

Inherits:
Object
  • Object
show all
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}/%{resource_slug}/"
DESCRIPTION_TEMPLATE =
"%{complete}/%{total} translations complete."
CONTEXT =
'continuous-localization/txgh'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, repo, tx_resource) ⇒ GithubStatus

Returns a new instance of GithubStatus.



24
25
26
27
28
# File 'lib/txgh/github_status.rb', line 24

def initialize(project, repo, tx_resource)
  @project = project
  @repo = repo
  @tx_resource = tx_resource
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



22
23
24
# File 'lib/txgh/github_status.rb', line 22

def project
  @project
end

#repoObject (readonly)

Returns the value of attribute repo.



22
23
24
# File 'lib/txgh/github_status.rb', line 22

def repo
  @repo
end

#tx_resourceObject (readonly)

Returns the value of attribute tx_resource.



22
23
24
# File 'lib/txgh/github_status.rb', line 22

def tx_resource
  @tx_resource
end

Instance Method Details

#update(sha) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/txgh/github_status.rb', line 30

def update(sha)
  repo.api.create_status(
    repo.name, sha, state, {
      context: context, target_url: target_url, description: description
    }
  )
end