Module: Mycloud
- Defined in:
- lib/mycloud.rb,
lib/mycloud/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
- .get_unlink_token(options = {}) ⇒ Object
- .get_upload_token(options = {}) ⇒ Object
- .unlink_file(options = {}) ⇒ Object
- .upload_file(options = {}) ⇒ Object
Class Method Details
.get_unlink_token(options = {}) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/mycloud.rb', line 29 def self.get_unlink_token(={}) access_token = [:access_token] secret_token = [:secret_token] unlink_token_uri = [:unlink_token_uri] data="access_token=#{access_token}&secret_token=#{secret_token}" res = RestClient.post unlink_token_uri,data, :accept=>:json hsh = JSON.parse(res) end |
.get_upload_token(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/mycloud.rb', line 6 def self.get_upload_token(={}) access_token = [:access_token] secret_token = [:secret_token] upload_token_uri = [:upload_token_uri] data="access_token=#{access_token}&secret_token=#{secret_token}" res = RestClient.post upload_token_uri,data, :accept=>:json hsh = JSON.parse(res) end |
.unlink_file(options = {}) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/mycloud.rb', line 38 def self.unlink_file(={}) unlink_token = [:unlink_token] file_id = [:file_id] unlink_file_uri = [:unlink_file_uri] data="unlink_token=#{unlink_token}&file_id=#{file_id}" res = RestClient.post unlink_file_uri,data, :accept=>:json hsh = JSON.parse(res) end |
.upload_file(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mycloud.rb', line 15 def self.upload_file(={}) #data="upload_token=#{upload_token}&sky_name=#{sky_name}&tags=#{tags}" #res = RestClient.post upload_file_uri,data ,:accept=>:json res = RestClient.post([:upload_file_uri], { :upload_token => [:upload_token], :sky_name => [:sky_name], :tags => [:tags], :uploaded_file => File.new([:file_path]) }) hsh = JSON.parse(res) end |