Class: GitComitter::Pipeline
- Inherits:
-
Object
- Object
- GitComitter::Pipeline
- Defined in:
- lib/git-comitter/cruise.rb
Instance Method Summary collapse
-
#initialize(cruise_url, pipeline) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #status(stage) ⇒ Object
Constructor Details
#initialize(cruise_url, pipeline) ⇒ Pipeline
Returns a new instance of Pipeline.
24 25 26 27 |
# File 'lib/git-comitter/cruise.rb', line 24 def initialize(cruise_url, pipeline) @pipe = pipeline @cruise_url = cruise_url end |
Instance Method Details
#status(stage) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/git-comitter/cruise.rb', line 29 def status(stage) url = "#{@cruise_url}?pipelineName=#{@pipe}&stageName=#{stage}&perPage=2" urlObj = URI.parse(url) req = Net::HTTP::Get.new(urlObj.path + '?' + urlObj.query) res = Net::HTTP.start(urlObj.host, urlObj.port) {|http| http.request(req)} history = JSON.parse(res.body)["history"] status = history.first["current_status"] status = history.second["current_status"] if status == 'building' status end |