Class: Libgss::AssetRequest
- Inherits:
-
Object
- Object
- Libgss::AssetRequest
- Defined in:
- lib/libgss/asset_request.rb
Constant Summary collapse
- STATUS_PREPARING =
0
- STATUS_SENDING =
1
- STATUS_WAITING =
2
- STATUS_RECEIVED =
3
- STATUS_SUCCESS =
4
- STATUS_ERROR =
5
- STATUS_TIMEOUT =
6
Instance Attribute Summary collapse
-
#req_headers ⇒ Object
readonly
Returns the value of attribute req_headers.
-
#response_data ⇒ Object
readonly
Returns the value of attribute response_data.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(httpclient, url, req_headers) ⇒ AssetRequest
constructor
コンストラクタ.
- #send_request(&callback) ⇒ Object
Constructor Details
#initialize(httpclient, url, req_headers) ⇒ AssetRequest
コンストラクタ
16 17 18 19 20 21 22 |
# File 'lib/libgss/asset_request.rb', line 16 def initialize(httpclient, url, req_headers) @httpclient = httpclient @url = url @req_headers = req_headers @response_data = nil @status = STATUS_PREPARING end |
Instance Attribute Details
#req_headers ⇒ Object (readonly)
Returns the value of attribute req_headers.
13 14 15 |
# File 'lib/libgss/asset_request.rb', line 13 def req_headers @req_headers end |
#response_data ⇒ Object (readonly)
Returns the value of attribute response_data.
13 14 15 |
# File 'lib/libgss/asset_request.rb', line 13 def response_data @response_data end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
13 14 15 |
# File 'lib/libgss/asset_request.rb', line 13 def status @status end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
13 14 15 |
# File 'lib/libgss/asset_request.rb', line 13 def url @url end |
Instance Method Details
#send_request(&callback) ⇒ Object
24 25 26 27 28 |
# File 'lib/libgss/asset_request.rb', line 24 def send_request(&callback) res = @httpclient.get(url, nil, req_headers) @response_data = res.body callback.call(@response_data) if callback end |