ku6vms_sdk 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/grand_cloud/base.rb +4 -1
- data/lib/grand_cloud/version.rb +1 -1
- data/lib/grand_cloud/video.rb +13 -5
- metadata +2 -2
data/lib/grand_cloud/base.rb
CHANGED
@@ -20,9 +20,12 @@ module GrandCloud
|
|
20
20
|
|
21
21
|
url = URI.escape((options[:url] || ("http://#{(options[:host] || DEFAULT_HOST_URL)+options[:uri]}")) + "?" + protocal_params)+'&Signature='+CGI::escape(signature)
|
22
22
|
|
23
|
+
request_params = {}
|
24
|
+
request_params.merge!(options[:timeout]) if options[:timeout]
|
25
|
+
|
23
26
|
params = {:head => {:Accept => options[:header_accept] || 'application/json'}}
|
24
27
|
params.merge!(options[:request_params]) if options[:request_params]
|
25
|
-
EM::HttpRequest.new(url).send((options[:method] && options[:method].downcase) || "get", params)
|
28
|
+
EM::HttpRequest.new(url, request_params).send((options[:method] && options[:method].downcase) || "get", params)
|
26
29
|
end
|
27
30
|
|
28
31
|
def file_upload options
|
data/lib/grand_cloud/version.rb
CHANGED
data/lib/grand_cloud/video.rb
CHANGED
@@ -20,12 +20,13 @@ module GrandCloud
|
|
20
20
|
EM.run { yield }
|
21
21
|
end
|
22
22
|
|
23
|
-
def create title, &block
|
23
|
+
def create title, pass_encoding=false, &block
|
24
24
|
creation = Base.send_request({
|
25
25
|
:method => 'post',
|
26
26
|
:uri => '/video',
|
27
27
|
:additional_params => {
|
28
|
-
:Title => title
|
28
|
+
:Title => title,
|
29
|
+
:BypassEncoding => pass_encoding
|
29
30
|
}
|
30
31
|
})
|
31
32
|
creation.callback { block.call(JSON.parse(creation.response)) }
|
@@ -36,10 +37,10 @@ module GrandCloud
|
|
36
37
|
end
|
37
38
|
|
38
39
|
# upload is an async method
|
39
|
-
def upload title, file_path, &block
|
40
|
+
def upload title, file_path, pass_encoding=nil, &block
|
40
41
|
file = File.new(file_path)
|
41
42
|
|
42
|
-
self.create(title) do |rep|
|
43
|
+
self.create(title, pass_encoding) do |rep|
|
43
44
|
|
44
45
|
GrandCloud.logger.warn(rep)
|
45
46
|
|
@@ -54,7 +55,11 @@ module GrandCloud
|
|
54
55
|
:cfrom => 'client',
|
55
56
|
:filesize => file.size,
|
56
57
|
:ext => File.extname(file)
|
58
|
+
},
|
59
|
+
:timeout => {
|
60
|
+
:inactivity_timeout => 0
|
57
61
|
}
|
62
|
+
|
58
63
|
})
|
59
64
|
callback(req, block.to_proc, rep.select{|k, v| k =='sid' || k =='vid'})
|
60
65
|
end
|
@@ -74,6 +79,9 @@ module GrandCloud
|
|
74
79
|
:uploadUrl => rep['uploadUrl'],
|
75
80
|
:accessKey => Base.snda_access_key_id,
|
76
81
|
:secretKey => Base.secret_access_key
|
82
|
+
},
|
83
|
+
:timeout => {
|
84
|
+
:inactivity_timeout => 0
|
77
85
|
}
|
78
86
|
|
79
87
|
})
|
@@ -201,7 +209,7 @@ module GrandCloud
|
|
201
209
|
end
|
202
210
|
req.errback do
|
203
211
|
response.fail(nil)
|
204
|
-
raise Error::ResponseError.new("Maybe the network doesn't working")
|
212
|
+
raise Error::ResponseError.new("Error is #{req.error}, Maybe the network doesn't working")
|
205
213
|
EM.stop
|
206
214
|
end
|
207
215
|
response
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ku6vms_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: em-http-request
|