Class: HttpStub::Configurer::Request::Http::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/configurer/request/http/factory.rb

Class Method Summary collapse

Class Method Details

.activate(uri) ⇒ Object



20
21
22
# File 'lib/http_stub/configurer/request/http/factory.rb', line 20

def activate(uri)
  get(uri.start_with?("/") ? uri : "/#{uri}")
end

.delete(path) ⇒ Object



32
33
34
# File 'lib/http_stub/configurer/request/http/factory.rb', line 32

def delete(path)
  to_basic_request(Net::HTTP::Delete.new(path))
end

.get(path) ⇒ Object



24
25
26
# File 'lib/http_stub/configurer/request/http/factory.rb', line 24

def get(path)
  to_basic_request(Net::HTTP::Get.new(path))
end

.post(path) ⇒ Object



28
29
30
# File 'lib/http_stub/configurer/request/http/factory.rb', line 28

def post(path)
  to_basic_request(Net::HTTP::Post.new(path).tap { |request| request.body = "" })
end

.scenario(model) ⇒ Object Also known as: stub_activator



14
15
16
# File 'lib/http_stub/configurer/request/http/factory.rb', line 14

def scenario(model)
  HttpStub::Configurer::Request::Http::Multipart.new("/stubs/scenarios", model)
end

.stub(model) ⇒ Object



10
11
12
# File 'lib/http_stub/configurer/request/http/factory.rb', line 10

def stub(model)
  HttpStub::Configurer::Request::Http::Multipart.new("/stubs", model)
end