Class: Yarr::EvaluatorService::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/yarr/evaluator_service.rb

Overview

response of the web request

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Response

Returns a new instance of Response.

Parameters:

  • data (String)

    raw data of the adapters response


54
55
56
# File 'lib/yarr/evaluator_service.rb', line 54

def initialize(data)
  @data = JSON.parse(data)
end

Instance Method Details

#outputObject

unified stdout / stderr with appropriate rocket / stderr prefix


64
65
66
67
68
69
70
# File 'lib/yarr/evaluator_service.rb', line 64

def output
  Message::Truncator.truncate(
    stderr.empty? ? stdout.prepend('# => ') : stderr.prepend('stderr: '),
    omission: '... check link for more',
    suffix: " (#{url})"
  )
end

#urlObject

url that points to the evaluation


59
60
61
# File 'lib/yarr/evaluator_service.rb', line 59

def url
  @data['run_request']['run']['html_url']
end