Class: Yarr::EvaluatorService

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

Overview

A wrapper on a web request that uses carc.in

Defined Under Namespace

Classes: Request, Response

Constant Summary collapse

URL =
'https://carc.in/run_requests'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(web_service = Typhoeus) ⇒ EvaluatorService


13
14
15
# File 'lib/yarr/evaluator_service.rb', line 13

def initialize(web_service = Typhoeus)
  @web_service = web_service
end

Instance Method Details

#request(request) ⇒ Response

Sends a request to the web service and returns the response


20
21
22
23
24
25
26
27
28
# File 'lib/yarr/evaluator_service.rb', line 20

def request(request)
  response_body = @web_service.post(
    URL,
    body: request.to_wire,
    headers: headers
  ).response_body

  Response.new(response_body)
end