Class: Sketchup::Http::Request
- Inherits:
-
Object
- Object
- Sketchup::Http::Request
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb
Overview
Http::Request objects allows you to send HTTP request to HTTP servers.
Instance Method Summary collapse
-
#body ⇒ String
Gets the http body that is going to be used when sending the request.
-
#body=(body) ⇒ String
Sets the http body that is going to be used when sending the request.
-
#cancel ⇒ true
Cancels the request.
-
#headers ⇒ Hash
Returns the http headers that are going to be used when sending the request.
-
#headers=(headers) ⇒ Boolean
Sets the http headers that are going to be used when sending the request.
-
#initialize(url, method) ⇒ Request
constructor
The new method is used to create a new Sketchup::Http::Request.
-
#method ⇒ String
Returns the http method that is going to be used when sending the request.
-
#method=(method) ⇒ Boolean
Sets the http method that is going to be used when sending the request.
-
#set_download_progress_callback {|current, total| ... } ⇒ Boolean
Adds a download progress callback block that will get called everytime we have received data from the server until the download finishes.
-
#set_upload_progress_callback {|current, total| ... } ⇒ Boolean
Adds a upload progress callback block that will get called everytime we have uploaded data to the server until the upload finishes.
-
#start {|request, response| ... } ⇒ Boolean
Starts the request and optionally add a callback block.
-
#status ⇒ int
Returns the internal status code.
-
#url ⇒ String
Returns a copy of the Request’s URL.
Constructor Details
#initialize(url, method) ⇒ Request
If no reference is kept to the Sketchup::Http::Request, it can be garbage collected, making the download silently fail. This is especially noticeable for larger downloads that takes longer time.
The new method is used to create a new Sketchup::Http::Request.
The default port is 80, to use a different port define it in the URL when creating a new Sketchup::Http::Request.
The method
parameter accepts any custom http method or one of the following:
-
Sketchup::Http::GET
-
Sketchup::Http::POST
-
Sketchup::Http::PUT
-
Sketchup::Http::DELETE
-
Sketchup::Http::HEAD
-
Sketchup::Http::OPTIONS
131 132 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 131 def initialize(url, method) end |
Instance Method Details
#body ⇒ String
Gets the http body that is going to be used when sending the request.
23 24 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 23 def body end |
#body=(body) ⇒ String
Sets the http body that is going to be used when sending the request.
42 43 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 42 def body=(body) end |
#cancel ⇒ true
Cancels the request.
58 59 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 58 def cancel end |
#headers ⇒ Hash
Returns the http headers that are going to be used when sending the request.
74 75 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 74 def headers end |
#headers=(headers) ⇒ Boolean
Sets the http headers that are going to be used when sending the request.
93 94 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 93 def headers=(headers) end |
#method ⇒ String
Returns the http method that is going to be used when sending the request.
146 147 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 146 def method end |
#method=(method) ⇒ Boolean
Sets the http method that is going to be used when sending the request. The value can be any custom http method or one of the following:
-
Sketchup::Http::GET
-
Sketchup::Http::POST
-
Sketchup::Http::PUT
-
Sketchup::Http::DELETE
-
Sketchup::Http::HEAD
-
Sketchup::Http::OPTIONS
172 173 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 172 def method=(method) end |
#set_download_progress_callback {|current, total| ... } ⇒ Boolean
total
is -1 if the server doesn’t specify a file size in the response header.
Adds a download progress callback block that will get called everytime we have received data from the server until the download finishes.
205 206 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 205 def set_download_progress_callback end |
#set_upload_progress_callback {|current, total| ... } ⇒ Boolean
Adds a upload progress callback block that will get called everytime we have uploaded data to the server until the upload finishes.
232 233 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 232 def set_upload_progress_callback end |
#start {|request, response| ... } ⇒ Boolean
Starts the request and optionally add a callback block.
256 257 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 256 def start end |
#status ⇒ int
Returns the internal status code. It can be one of the following:
-
Sketchup::Http::STATUS_UNKNOWN
-
Sketchup::Http::STATUS_SUCCESS
-
Sketchup::Http::STATUS_PENDING
-
Sketchup::Http::STATUS_CANCELED
-
Sketchup::Http::STATUS_FAILED
274 275 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 274 def status end |
#url ⇒ String
Returns a copy of the Request’s URL.
289 290 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb', line 289 def url end |