Class: Vx::ServiceConnector::Bitbucket::Commits
- Inherits:
-
Struct
- Object
- Struct
- Vx::ServiceConnector::Bitbucket::Commits
- Defined in:
- lib/vx/service_connector/bitbucket/commits.rb
Instance Attribute Summary collapse
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#session ⇒ Object
Returns the value of attribute session.
Instance Method Summary collapse
Instance Attribute Details
#repo ⇒ Object
Returns the value of attribute repo
4 5 6 |
# File 'lib/vx/service_connector/bitbucket/commits.rb', line 4 def repo @repo end |
#session ⇒ Object
Returns the value of attribute session
4 5 6 |
# File 'lib/vx/service_connector/bitbucket/commits.rb', line 4 def session @session end |
Instance Method Details
#last(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vx/service_connector/bitbucket/commits.rb', line 5 def last( = {}) begin commits = session.get "api/1.0/repositories/#{repo.full_name}/changesets/?limit=1" commit = commits["changesets"].first , email = commit["raw_author"].split(/[<>]/) sha = commit["raw_node"] branch = commit["branch"] || 'master' Model::Payload.from_hash( skip: false, pull_request?: false, branch: branch, branch_label: branch, sha: sha, message: commit["message"], author: .strip, author_email: email, web_url: session.endpoint.to_s + "/#{repo.full_name}/commits/#{sha}" ) rescue RequestError nil end end |