class Webspicy::Web::HttpClient

Attributes

api[R]

Public Class Methods

new(scope) click to toggle source
Calls superclass method Webspicy::Tester::Client::new
# File lib/webspicy/web/client/http_client.rb, line 16
def initialize(scope)
  super(scope)
  @api = Api.new(scope)
end

Public Instance Methods

_call(test_case) click to toggle source
# File lib/webspicy/web/client/http_client.rb, line 22
def _call(test_case)
  service, specification = test_case.service, test_case.specification

  # Instantiate the parameters
  headers = test_case.headers
  params  = test_case.dress_params? ? service.dress_params(test_case.params) : test_case.params
  body    = test_case.body || test_case.located_file_upload

  # Instantiate the url and strip parameters
  url, params = specification.instantiate_url(params)

  # Globalize the URL if required
  url = scope.to_real_url(url, test_case)

  # Invoke the service now
  api.public_send(service.method.to_s.downcase.to_sym, url, params, headers, body)

  # Return the response
  api.last_response
end