elibri_watermarking 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,6 @@
1
1
  require 'net/http'
2
+ require 'net/https'
3
+ require 'uri'
2
4
  require 'digest/md5'
3
5
 
4
6
  module ElibriWatermarking
@@ -19,9 +21,15 @@ module ElibriWatermarking
19
21
  uri = URI(self.url + '/watermark')
20
22
  formats = formats.join(",") if formats.is_a?(Array)
21
23
  timestamp = Time.now.to_i
22
- sig = Digest::MD5.hexdigest("#{self.secret}_#{timestamp}")
23
- res = Net::HTTP.post_form(uri, ident_type => ident, 'formats' => formats, 'visible_watermark' => visible_watermark,
24
- 'title_postfix' => title_postfix, 'stamp' => timestamp, 'sig' => sig, 'token' => self.token)
24
+ sig = Digest::MD5.hexdigest("#{self.secret}_#{timestamp}")
25
+ data = {ident_type => ident, 'formats' => formats, 'visible_watermark' => visible_watermark,
26
+ 'title_postfix' => title_postfix, 'stamp' => timestamp, 'sig' => sig, 'token' => self.token}
27
+ req = Net::HTTP::Post.new(uri.path)
28
+ req.set_form_data(data)
29
+ http = Net::HTTP.new(uri.host, uri.port)
30
+ http.use_ssl = true
31
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
32
+ res = http.start {|http| http.request(req) }
25
33
  return validate_response(res)
26
34
  end
27
35
 
@@ -29,7 +37,14 @@ module ElibriWatermarking
29
37
  uri = URI(self.url + '/deliver')
30
38
  timestamp = Time.now.to_i
31
39
  sig = Digest::MD5.hexdigest("#{self.secret}_#{timestamp}")
32
- res = Net::HTTP.post_form(uri, 'stamp' => timestamp, 'sig' => sig, 'token' => self.token, 'trans_id' => trans_id)
40
+ data = {'stamp' => timestamp, 'sig' => sig, 'token' => self.token, 'trans_id' => trans_id}
41
+ req = Net::HTTP::Post.new(uri.path)
42
+ req = Net::HTTP::Post.new(uri.path)
43
+ req.set_form_data(data)
44
+ http = Net::HTTP.new(uri.host, uri.port)
45
+ http.use_ssl = true
46
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
47
+ res = http.start {|http| http.request(req) }
33
48
  return validate_response(res)
34
49
  end
35
50
 
@@ -1,3 +1,3 @@
1
1
  module ElibriWatermarking
2
- VERSION = "0.1"
2
+ VERSION = "0.2"
3
3
  end
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elibri_watermarking
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 15
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
- - 1
8
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
9
10
  platform: ruby
10
11
  authors:
11
12
  - Piotr Szmielew
@@ -13,21 +14,22 @@ autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
16
 
16
- date: 2012-06-23 00:00:00 +02:00
17
- default_executable:
17
+ date: 2012-06-30 00:00:00 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
- type: :development
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
20
+ name: rake
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
22
24
  requirements:
23
25
  - - ">="
24
26
  - !ruby/object:Gem::Version
27
+ hash: 3
25
28
  segments:
26
29
  - 0
27
30
  version: "0"
28
- name: rake
29
- requirement: *id001
30
- prerelease: false
31
+ type: :development
32
+ version_requirements: *id001
31
33
  description: Gem designed to help in use of Elibri watermarking API.
32
34
  email:
33
35
  - p.szmielew@ava.waw.pl
@@ -46,7 +48,6 @@ files:
46
48
  - lib/elibri_watermarking/client.rb
47
49
  - lib/elibri_watermarking/exceptions.rb
48
50
  - lib/elibri_watermarking/version.rb
49
- has_rdoc: true
50
51
  homepage: http://elibri.com.pl
51
52
  licenses: []
52
53
 
@@ -56,23 +57,27 @@ rdoc_options: []
56
57
  require_paths:
57
58
  - lib
58
59
  required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
59
61
  requirements:
60
62
  - - ">="
61
63
  - !ruby/object:Gem::Version
64
+ hash: 3
62
65
  segments:
63
66
  - 0
64
67
  version: "0"
65
68
  required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
66
70
  requirements:
67
71
  - - ">="
68
72
  - !ruby/object:Gem::Version
73
+ hash: 3
69
74
  segments:
70
75
  - 0
71
76
  version: "0"
72
77
  requirements: []
73
78
 
74
79
  rubyforge_project: elibri_watermarking
75
- rubygems_version: 1.3.6
80
+ rubygems_version: 1.8.21
76
81
  signing_key:
77
82
  specification_version: 3
78
83
  summary: Gem designed to help in use of Elibri watermarking API.