Class: Richard::III

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

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ III

Returns a new instance of III.



11
12
13
# File 'lib/richard_iii.rb', line 11

def initialize(opts={})
  @internet = opts[:internet] || fail("You need to supply :internet")
end

Instance Method Details

#exec(text) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/richard_iii.rb', line 15

def exec(text)
  request_line = request_line_from text

  reply = @internet.execute(
    Richard::Request.new(
      :verb     => request_line.verb, 
      :uri      => request_line.uri,
      :headers  => headers_from(text),
      :body     => body_from(text)
    )
  )

  Internal::CurlFormat.as_string reply
end