class Contracto::RSpec::JsonHelper::ContractRequest
Public Class Methods
new(request)
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 56 def initialize(request) @request = request end
Public Instance Methods
body()
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 60 def body HTTParty.send( http_method, contract_server_url, query: params, headers: http_headers ).body end
Private Instance Methods
contract_server_url()
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 70 def contract_server_url @request.original_url.gsub('www.example.com', "0.0.0.0:#{Contracto::Constants::PORT}") end
http_headers()
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 82 def http_headers @request.env.select {|k,v| k.start_with? 'HTTP_'} end
http_method()
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 78 def http_method @request.method.downcase end
params()
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 74 def params @request.params.to_hash end