elibri_watermarking 0.8.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,13 +19,15 @@ module ElibriWatermarking
19
19
  self.servers = servers
20
20
  end
21
21
 
22
- def watermark(ident, formats, visible_watermark, title_postfix, customer_ip, client_symbol = nil, supplier = nil)
22
+ def watermark(ident, formats, visible_watermark, title_postfix, customer_ip, client_symbol = nil, supplier = nil, delivery_form = nil)
23
23
  ident =~ /^[0-9]+$/ ? ident_type = 'isbn' : ident_type = 'record_reference'
24
24
  raise WrongFormats.new if formats.is_a?(String) && !formats =~ /^(epub|mobi|pdf|mp3_in_zip|,)+$/
25
25
  raise WrongFormats.new if formats.is_a?(Array) && ((formats - ['epub','mobi','pdf','mp3_in_zip']) != [] || (formats & ['epub','mobi','pdf','mp3_in_zip']).count < 1)
26
26
  formats = formats.join(",") if formats.is_a?(Array)
27
+ raise ParametersError.new if delivery_form && formats != 'mp3_in_zip'
28
+ raise ParametersError.new if delivery_form && (delivery_form != 'mp3' && delivery_form != 'zip')
27
29
  data = {ident_type => ident, 'formats' => formats, 'visible_watermark' => visible_watermark,
28
- 'title_postfix' => title_postfix, 'client_symbol' => client_symbol}
30
+ 'title_postfix' => title_postfix, 'client_symbol' => client_symbol, 'delivery_form' => delivery_form}
29
31
  data.merge!(:supplier => supplier) if supplier
30
32
  data.merge!(:customer_ip => customer_ip) if customer_ip
31
33
 
@@ -40,9 +42,9 @@ module ElibriWatermarking
40
42
  end
41
43
  end
42
44
 
43
- def retry(trans_id)
45
+ def retry(trans_id, delivery_form = nil)
44
46
  try_with_different_servers('retry') do |uri|
45
- return get_response_from_server(uri, {'trans_id' => trans_id}, Net::HTTP::Post)
47
+ return get_response_from_server(uri, {'trans_id' => trans_id, 'delivery_form' => delivery_form}, Net::HTTP::Post)
46
48
  end
47
49
  end
48
50
 
@@ -1,3 +1,3 @@
1
1
  module ElibriWatermarking
2
- VERSION = "0.8.4"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elibri_watermarking
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 8
9
- - 4
10
- version: 0.8.4
8
+ - 9
9
+ - 0
10
+ version: 0.9.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Piotr Szmielew
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-12-21 00:00:00 Z
19
+ date: 2013-01-04 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rake