class CircleCI::CLI::Response::Action

Attributes

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

Public Class Methods

new(hash) click to toggle source
# File lib/circleci/cli/response/action.rb, line 9
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/circleci/cli/response/action.rb, line 28
def failed?
  @status == 'timedout' || @status == 'failed'
end
log() click to toggle source
# File lib/circleci/cli/response/action.rb, line 16
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/circleci/cli/response/action.rb, line 34
def request(url)
  JSON.parse(Faraday.new(url).get.body)
end