Class: COS::HTTP
Constant Summary collapse
- DEFAULT_CONTENT_TYPE =
默认content-type
'application/json'
- OPEN_TIMEOUT =
请求创建超时
30
- READ_TIMEOUT =
响应读取超时
120
Constants included from Logging
Logging::DEFAULT_LOG_FILE, Logging::MAX_NUM_LOG, Logging::ROTATE_SIZE
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
Instance Method Summary collapse
-
#get(path, headers, signature = nil) ⇒ Object
GET请求.
-
#initialize(config) ⇒ HTTP
constructor
A new instance of HTTP.
-
#post(path, headers, signature, payload) ⇒ Object
POST请求.
Methods included from Logging
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
21 22 23 |
# File 'lib/cos/http.rb', line 21 def config @config end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
21 22 23 |
# File 'lib/cos/http.rb', line 21 def signature @signature end |
Instance Method Details
#get(path, headers, signature = nil) ⇒ Object
GET请求
29 30 31 |
# File 'lib/cos/http.rb', line 29 def get(path, headers, signature = nil) do_request('GET', path, headers, signature) end |
#post(path, headers, signature, payload) ⇒ Object
POST请求
34 35 36 |
# File 'lib/cos/http.rb', line 34 def post(path, headers, signature, payload) do_request('POST', path, headers, signature, payload) end |