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.
@@ -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
 
@@ -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.to_yaml
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.merge!({'auth' => request})
27
+ params['auth'] = request
28
28
  result = send_request(params)
29
29
  parse_response(result)
30
30
  end
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module DMCloud
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: