Class: Hurley::Request
- Inherits:
-
Struct
- Object
- Struct
- Hurley::Request
- Extended by:
- Forwardable
- Defined in:
- lib/hurley/client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#header ⇒ Object
Returns the value of attribute header.
-
#options ⇒ Object
Returns the value of attribute options.
-
#ssl_options ⇒ Object
Returns the value of attribute ssl_options.
-
#url ⇒ Object
Returns the value of attribute url.
-
#verb ⇒ Object
Returns the value of attribute verb.
Instance Method Summary collapse
- #body_io ⇒ Object
- #inspect ⇒ Object
- #on_body(*statuses) ⇒ Object
- #prepare! ⇒ Object
- #query_string ⇒ Object
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
135 136 137 |
# File 'lib/hurley/client.rb', line 135 def body @body end |
#header ⇒ Object
Returns the value of attribute header
135 136 137 |
# File 'lib/hurley/client.rb', line 135 def header @header end |
#options ⇒ Object
Returns the value of attribute options
135 136 137 |
# File 'lib/hurley/client.rb', line 135 def @options end |
#ssl_options ⇒ Object
Returns the value of attribute ssl_options
135 136 137 |
# File 'lib/hurley/client.rb', line 135 def @ssl_options end |
#url ⇒ Object
Returns the value of attribute url
135 136 137 |
# File 'lib/hurley/client.rb', line 135 def url @url end |
#verb ⇒ Object
Returns the value of attribute verb
135 136 137 |
# File 'lib/hurley/client.rb', line 135 def verb @verb end |
Instance Method Details
#body_io ⇒ Object
156 157 158 159 160 161 162 163 164 |
# File 'lib/hurley/client.rb', line 156 def body_io return unless body if body.respond_to?(:read) body elsif body StringIO.new(body) end end |
#inspect ⇒ Object
170 171 172 173 174 175 176 |
# File 'lib/hurley/client.rb', line 170 def inspect "#<%s %s %s>" % [ self.class.name, verb.to_s.upcase, url.to_s, ] end |
#on_body(*statuses) ⇒ Object
166 167 168 |
# File 'lib/hurley/client.rb', line 166 def on_body(*statuses) @body_receiver = [statuses.empty? ? nil : statuses, Proc.new] end |
#prepare! ⇒ Object
178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/hurley/client.rb', line 178 def prepare! prepare_basic_auth! if body prepare_body! else return unless REQUIRED_BODY_VERBS.include?(verb) end prepare_content_length! end |
#query_string ⇒ Object
152 153 154 |
# File 'lib/hurley/client.rb', line 152 def query_string url.query.to_query_string end |