Class: Aliyun::Oss::Http

Inherits:
Object
  • Object
show all
Defined in:
lib/aliyun/oss/http.rb

Overview

nodoc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_key, secret_key, host) ⇒ Http

Returns a new instance of Http.



6
7
8
9
10
# File 'lib/aliyun/oss/http.rb', line 6

def initialize(access_key, secret_key, host)
  @access_key = access_key
  @secret_key = secret_key
  @host = host
end

Instance Attribute Details

#access_keyObject (readonly)

Returns the value of attribute access_key.



4
5
6
# File 'lib/aliyun/oss/http.rb', line 4

def access_key
  @access_key
end

#secret_keyObject (readonly)

Returns the value of attribute secret_key.



4
5
6
# File 'lib/aliyun/oss/http.rb', line 4

def secret_key
  @secret_key
end

Instance Method Details

#delete(uri, options = {}) ⇒ Object



26
27
28
29
# File 'lib/aliyun/oss/http.rb', line 26

def delete(uri, options = {})
  headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge(options[:headers] || {})
  request('DELETE', uri, options.merge(headers: headers))
end

#get(uri, options = {}) ⇒ Object



12
13
14
# File 'lib/aliyun/oss/http.rb', line 12

def get(uri, options = {})
  request('GET', uri, options)
end

#head(uri, options = {}) ⇒ Object



35
36
37
# File 'lib/aliyun/oss/http.rb', line 35

def head(uri, options = {})
  request('HEAD', uri, options)
end

#options(uri, options = {}) ⇒ Object



31
32
33
# File 'lib/aliyun/oss/http.rb', line 31

def options(uri, options = {})
  request('OPTIONS', uri, options)
end

#post(uri, options = {}) ⇒ Object



21
22
23
24
# File 'lib/aliyun/oss/http.rb', line 21

def post(uri, options = {})
  headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge(options[:headers] || {})
  request('POST', uri, options.merge(headers: headers))
end

#put(uri, options = {}) ⇒ Object



16
17
18
19
# File 'lib/aliyun/oss/http.rb', line 16

def put(uri, options = {})
  headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge(options[:headers] || {})
  request('PUT', uri, options.merge(headers: headers))
end