Class: UpyunRainbow::Util
- Inherits:
-
Object
- Object
- UpyunRainbow::Util
- Defined in:
- lib/upyun-rainbow/upyun-rainbow.rb
Instance Method Summary collapse
- #delete(url, options = {}) ⇒ Object
- #get(url, options = {}) ⇒ Object
-
#initialize(bucket = nil, user = nil, pwd = nil, api_host = "http://v0.api.upyun.com") ⇒ Util
constructor
A new instance of Util.
- #post(url, data, options = {}) ⇒ Object
- #put(url, data, options = {}) ⇒ Object
Constructor Details
#initialize(bucket = nil, user = nil, pwd = nil, api_host = "http://v0.api.upyun.com") ⇒ Util
Returns a new instance of Util.
11 12 13 14 15 16 |
# File 'lib/upyun-rainbow/upyun-rainbow.rb', line 11 def initialize bucket=nil, user=nil, pwd=nil, api_host="http://v0.api.upyun.com" @api_host = api_host || configatron.upaiyun.api_host @bucket = bucket || configatron.upaiyun.bucket_name @user = user || configatron.upaiyun.user_name @password = pwd || configatron.upaiyun.password end |
Instance Method Details
#delete(url, options = {}) ⇒ Object
33 34 35 36 |
# File 'lib/upyun-rainbow/upyun-rainbow.rb', line 33 def delete url, ={} relative_path = get_relative_path url result = process :delete, relative_path, end |
#get(url, options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/upyun-rainbow/upyun-rainbow.rb', line 18 def get url, ={} relative_path = get_relative_path url result = process :get, relative_path, end |
#post(url, data, options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/upyun-rainbow/upyun-rainbow.rb', line 28 def post url, data, ={} relative_path = get_relative_path url result = process :post, relative_path, data, {'Expect' => '', 'Mkdir' => 'true'}.merge() end |
#put(url, data, options = {}) ⇒ Object
23 24 25 26 |
# File 'lib/upyun-rainbow/upyun-rainbow.rb', line 23 def put url, data, ={} relative_path = get_relative_path url result = process :put, relative_path, data, end |