class Circler::Action

Attributes

name[R]
run_time_millis[R]
status[R]

Public Class Methods

new(hash) click to toggle source
# File lib/circler/response/action.rb, line 6
def initialize(hash)
  @hash = hash
  @name = hash['name']
  @status = hash['status']
  @run_time_millis = hash['run_time_millis']
end

Public Instance Methods

failed?() click to toggle source
# File lib/circler/response/action.rb, line 25
def failed?
  @status == 'timedout' || @status == 'failed'
end
log() click to toggle source
# File lib/circler/response/action.rb, line 13
def log
  request(@hash['output_url'])
    .map do |r|
      r['message']
        .gsub(/\r\n/, "\n")
        .gsub(/\e\[A\r\e\[2K/, '')
        .scan(/.{1,120}/)
        .join("\n")
    end
    .join("\n")
end

Private Instance Methods

request(url) click to toggle source
# File lib/circler/response/action.rb, line 31
def request(url)
  JSON.parse(Faraday.new(url).get.body)
end