dm_cloud 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dm_cloud/builder/media.rb +0 -3
- data/lib/dm_cloud/request.rb +4 -4
- data/lib/dm_cloud/signing.rb +4 -0
- data/lib/dm_cloud/version.rb +1 -1
- metadata +1 -1
@@ -21,13 +21,10 @@ module DMCloud
|
|
21
21
|
raise StandardError, "missing :media_id in params" unless media_id
|
22
22
|
request = Hash.new
|
23
23
|
|
24
|
-
puts 'media_id :' + media_id
|
25
|
-
|
26
24
|
# the media id
|
27
25
|
request['id'] = media_id
|
28
26
|
request['fields'] = []
|
29
27
|
|
30
|
-
|
31
28
|
# requested media meta datas
|
32
29
|
fields[:meta].each { |value| request['fields'] << "meta.#{value}" } if fields[:meta].present?
|
33
30
|
|
data/lib/dm_cloud/request.rb
CHANGED
@@ -6,7 +6,8 @@ module DMCloud
|
|
6
6
|
DAILYMOTION_API = 'http://api.dmcloud.net/api'
|
7
7
|
|
8
8
|
def self.send_request(params)
|
9
|
-
puts 'params : ' + params.
|
9
|
+
puts 'body request params : ' + params.to_json + "\n" + '-' * 80
|
10
|
+
|
10
11
|
@uri = URI.parse(DAILYMOTION_API)
|
11
12
|
|
12
13
|
http = Net::HTTP.new(@uri.host, @uri.port)
|
@@ -15,16 +16,15 @@ module DMCloud
|
|
15
16
|
request.content_type = 'application/json'
|
16
17
|
request.body = params.to_json
|
17
18
|
|
18
|
-
puts 'request : ' + request.to_yaml
|
19
|
+
puts 'request (YAML format ): ' + request.to_yaml + "\n" + '-' * 80
|
19
20
|
|
20
21
|
http.request(request).body
|
21
22
|
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
25
|
def self.execute(call, params = {})
|
26
26
|
request = DMCloud::Signing.identify(params)
|
27
|
-
params
|
27
|
+
params['auth'] = request
|
28
28
|
result = send_request(params)
|
29
29
|
parse_response(result)
|
30
30
|
end
|
data/lib/dm_cloud/signing.rb
CHANGED
@@ -11,8 +11,12 @@ module DMCloud
|
|
11
11
|
api_key = DMCloud.config[:secret_key]
|
12
12
|
|
13
13
|
normalized_request = normalize(request).to_s
|
14
|
+
puts 'normalized_values : ' + normalized_request + "\n" + '-' * 80
|
15
|
+
|
14
16
|
params = user_id + normalized_request + api_key
|
15
17
|
|
18
|
+
puts 'Values before MD5 encrypt : ' + params + "\n" + '-' * 80
|
19
|
+
|
16
20
|
checksum = Digest::MD5.hexdigest(params)
|
17
21
|
auth_token = user_id + ':' + checksum
|
18
22
|
|
data/lib/dm_cloud/version.rb
CHANGED