Class: Safettp::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/safettp/request.rb

Defined Under Namespace

Classes: Net

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, options = {}) ⇒ Request

Returns a new instance of Request.



4
5
6
7
8
# File 'lib/safettp/request.rb', line 4

def initialize(uri, options = {})
  @uri = URI(uri)
  @options = Safettp::HTTPOptions.new(options)
  @uri.query = @options.query
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



2
3
4
# File 'lib/safettp/request.rb', line 2

def options
  @options
end

#uriObject (readonly)

Returns the value of attribute uri.



2
3
4
# File 'lib/safettp/request.rb', line 2

def uri
  @uri
end

Instance Method Details

#perform(method) ⇒ Object



10
11
12
13
# File 'lib/safettp/request.rb', line 10

def perform(method)
  net = Safettp::Request::Net.new(method, uri, options)
  Safettp::Response.new(net.perform, options.parser)
end