Class: Smoke::Request
- Inherits:
-
Object
- Object
- Smoke::Request
- 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
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(uri, options = {}) ⇒ Request
constructor
A new instance of Request.
- #type ⇒ Object
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, = {}) @uri, @options = uri, dispatch end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
18 19 20 |
# File 'lib/smoke/request.rb', line 18 def body @body end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
18 19 20 |
# File 'lib/smoke/request.rb', line 18 def content_type @content_type end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
18 19 20 |
# File 'lib/smoke/request.rb', line 18 def uri @uri end |
Instance Method Details
#type ⇒ Object
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 |