Class: Smoke::Request

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

Overview

:nodoc:

Defined Under Namespace

Classes: Failure

Constant Summary collapse

SUPPORTED_TYPES =
%w(json xml javascript)
@@request_options =
{
  :user_agent       => Smoke.config[:user_agent],
  :accept_encoding  => "gzip, deflate"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Request.



20
21
22
23
# File 'lib/smoke/request.rb', line 20

def initialize(uri, options = {})
  @uri, @options = uri, options
  dispatch
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



18
19
20
# File 'lib/smoke/request.rb', line 18

def body
  @body
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



18
19
20
# File 'lib/smoke/request.rb', line 18

def content_type
  @content_type
end

#uriObject (readonly)

Returns the value of attribute uri.



18
19
20
# File 'lib/smoke/request.rb', line 18

def uri
  @uri
end

Instance Method Details

#typeObject



25
26
27
# File 'lib/smoke/request.rb', line 25

def type
  @type ||= @options[:type] || (SUPPORTED_TYPES.detect{|t| @content_type =~ /#{t}/ } || "unknown").to_sym
end