Class: HttpMonkey::EntryPoint
Instance Method Summary
collapse
#basic_auth, #digest_auth, #set_cookie, #with_header, #yield_request
Constructor Details
#initialize(client, url) ⇒ EntryPoint
Returns a new instance of EntryPoint.
39
40
41
42
|
# File 'lib/http_monkey/entry_point.rb', line 39
def initialize(client, url)
@client = client
@request = HTTPI::Request.new(url)
end
|
Instance Method Details
#_request ⇒ Object
44
45
46
|
# File 'lib/http_monkey/entry_point.rb', line 44
def _request
@request
end
|
#delete(&block) ⇒ Object
71
72
73
|
# File 'lib/http_monkey/entry_point.rb', line 71
def delete(&block)
capture_client(&block).http_request(:delete, @request)
end
|
#get(query_param = nil, &block) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/http_monkey/entry_point.rb', line 50
def get(query_param = nil, &block)
if query_param.kind_of?(Hash)
query_param = Rack::Utils.build_query(query_param)
end
query_param = query_param.to_s unless query_param.is_a?(String)
@request.url.query = query_param unless query_param.empty?
capture_client(&block).http_request(:get, @request)
end
|
#post(body_param, &block) ⇒ Object
61
62
63
64
|
# File 'lib/http_monkey/entry_point.rb', line 61
def post(body_param, &block)
@request.body = body_param
capture_client(&block).http_request(:post, @request)
end
|
#put(body_param, &block) ⇒ Object
66
67
68
69
|
# File 'lib/http_monkey/entry_point.rb', line 66
def put(body_param, &block)
@request.body = body_param
capture_client(&block).http_request(:put, @request)
end
|