class Smaak::NetHttpAdaptor
Attributes
request[R]
Public Class Methods
new(request)
click to toggle source
# File lib/smaak/adaptors/net_http_adaptor.rb, line 9 def initialize(request) raise ArgumentError.new("Must provide a Net::HTTPRequest") unless request.is_a? Net::HTTPRequest @request = request end
Public Instance Methods
body()
click to toggle source
# File lib/smaak/adaptors/net_http_adaptor.rb, line 35 def body @request.body end
body=(body)
click to toggle source
# File lib/smaak/adaptors/net_http_adaptor.rb, line 39 def body=(body) @request.body = body end
each_header(&block)
click to toggle source
# File lib/smaak/adaptors/net_http_adaptor.rb, line 19 def each_header(&block) @request.each_header(&block) end
host()
click to toggle source
# File lib/smaak/adaptors/net_http_adaptor.rb, line 23 def host URI.parse(@request.path).host end
method()
click to toggle source
# File lib/smaak/adaptors/net_http_adaptor.rb, line 31 def method @request.method end
path()
click to toggle source
# File lib/smaak/adaptors/net_http_adaptor.rb, line 27 def path URI.parse(@request.path).path end
set_header(header, value)
click to toggle source
# File lib/smaak/adaptors/net_http_adaptor.rb, line 14 def set_header(header, value) raise ArgumentError.new("Header must be a non-blank string") unless Smaak::Utils.non_blank_string?(header) @request[header] = value end