Class: HttpMonkey::EntryPoint

Inherits:
Object
  • Object
show all
Includes:
EntryPointFluentInterface
Defined in:
lib/http_monkey/entry_point.rb

Instance Method Summary collapse

Methods included from EntryPointFluentInterface

#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

#_requestObject



44
45
46
# File 'lib/http_monkey/entry_point.rb', line 44

def _request
  @request
end

#delete(&block) ⇒ Object



65
66
67
# File 'lib/http_monkey/entry_point.rb', line 65

def delete(&block)
  capture_client(&block).http_request(:delete, @request)
end

#get(query_param = nil, &block) ⇒ Object



50
51
52
53
# File 'lib/http_monkey/entry_point.rb', line 50

def get(query_param = nil, &block)
  @request.query = query_param unless query_param.nil?
  capture_client(&block).http_request(:get, @request)
end

#post(body_param, &block) ⇒ Object



55
56
57
58
# File 'lib/http_monkey/entry_point.rb', line 55

def post(body_param, &block)
  @request.body = body_param
  capture_client(&block).http_request(:post, @request)
end

#put(body_param, &block) ⇒ Object



60
61
62
63
# File 'lib/http_monkey/entry_point.rb', line 60

def put(body_param, &block)
  @request.body = body_param
  capture_client(&block).http_request(:put, @request)
end