Class: ModraUp::Http::Request
- Inherits:
-
Object
- Object
- ModraUp::Http::Request
Overview
Asynchronous HTTP request. Request#start takes an optional block that is called in the Ruby thread after completion. |request, response|.
SketchUp's official implementation may fail due to GC silent failures.
Class Method Summary # collapse
-
.new(url, method = ModraUp::Http::GET) ⇒ ModraUp::Http::Request
The default port is 80; other ports should be specified in the url. The method can be a custom verb or ModraUp::Http::GET / POST / PUT / DELETE / HEAD / OPTIONS / PATCH.
Instance Method Summary # collapse
-
#url ⇒ String
Copy the URL request.
-
#body ⇒ String
The body of the request to be sent.
-
#body=(body) ⇒ String
Set the request body.
-
#headers ⇒ Hash
The headers to be sent in the request.
-
#headers=(headers) ⇒ Boolean
Set the request headers. Keys will be to_s.
-
#method ⇒ String
The HTTP method to be used. This will override Object#method.
-
#method=(method) ⇒ Boolean
Set the HTTP method.
-
#status ⇒ Integer
Internal status: ModraUp::Http::STATUS_UNKNOWN / STATUS_SUCCESS / STATUS_PENDING / STATUS_CANCELED / STATUS_FAILED.
-
#cancel ⇒ true
Cancel the request. Do not call within the completion callback.
-
#set_download_progress_callback ⇒ Boolean
Download progress. If the server does not provide a length, total is set to -1.
-
#set_upload_progress_callback ⇒ Boolean
Upload progress.
-
#start ⇒ Boolean
Start the request. Returns false if already in progress or URL is empty. Do not call #cancel from the callback.
Class Method Details
Request.new(url, method = ModraUp::Http::GET) ⇒ request
The default port is 80; other ports should be specified in the url. The method can be a custom verb or ModraUp::Http::GET / POST / PUT / DELETE / HEAD / OPTIONS / PATCH.
Instance Method Details
request.url ⇒ String
Copy the URL request.
request.body ⇒ String
The body of the request to be sent.
request.body=(body) ⇒ String
Set the request body.
request.headers ⇒ Hash
The headers to be sent in the request.
request.headers=(headers) ⇒ Boolean
Set the request headers. Keys will be to_s.
request.method ⇒ String
The HTTP method to be used. This will override Object#method.
request.method=(method) ⇒ Boolean
Set the HTTP method.
request.status ⇒ Integer
Internal status: ModraUp::Http::STATUS_UNKNOWN / STATUS_SUCCESS / STATUS_PENDING / STATUS_CANCELED / STATUS_FAILED.
request.cancel ⇒ true
Cancel the request. Do not call within the completion callback.
request.set_download_progress_callback {|current, total| ... } ⇒ Boolean
Download progress. If the server does not provide a length, total is set to -1.
request.set_upload_progress_callback {|current, total| ... } ⇒ Boolean
Upload progress.
request.start {|request, response| ... } ⇒ Booleanrequest.start ⇒ Boolean
Start the request. Returns false if already in progress or URL is empty. Do not call #cancel from the callback.