docmago_client 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9536ecd03665d2dde981f55a9f8fcdbc11c21e6
4
- data.tar.gz: 8ee2f7771d3f421ceba8d29a21c78ea445a345a4
3
+ metadata.gz: c89287299ea4a9adcee215136397c4e267a4d112
4
+ data.tar.gz: a2ba36a6770c4cc4e8c00e62feb4d75864c86754
5
5
  SHA512:
6
- metadata.gz: 49f5cbdf4eeb7065ef615c7748d8005f6fa2f7329b6fa650ace1aba10da6816ccd4fcb3101a1e81dc0dee87df3452b55821768e638cbeb3552f1c4a5463942fd
7
- data.tar.gz: 7c3010309e42866505406ba8104a07eaee8817ea5e010546955dedabf8d71c89ff085c48f4958fed5f1120866853535005f99891a4e6a63ed2bf8b3c84f51237
6
+ metadata.gz: 10474ccbe476a4102b2ef29c3f015d59ddf422cd3b5168b53edb867c45f6ea8cb3f7e264963ff306a0693fc8f42b4812113fcc1d17bb89bde5e2c8d070c08857
7
+ data.tar.gz: 138a91ba6ae4de434fa3028345ef3f597e6d96df9f69c6d599c74520f17840ff024e3133120060ade651a5d2997e855180b1ed1b29e6962f34e743b9091d7c0b
@@ -42,7 +42,8 @@ module DocmagoClient
42
42
 
43
43
  default_options = {
44
44
  name: 'default',
45
- type: 'pdf'
45
+ type: 'pdf',
46
+ integrity_check: true
46
47
  }
47
48
 
48
49
  options = default_options.merge(options)
@@ -68,6 +69,10 @@ module DocmagoClient
68
69
  }
69
70
  end
70
71
 
72
+ if options[:integrity_check] && response.headers['X-Docmago-Checksum'] != Digest::MD5.hexdigest(response.body)
73
+ raise DocmagoClient::Error::IntegrityCheckError.new, 'File corrupt (invalid MD5 checksum)'
74
+ end
75
+
71
76
  if block_given?
72
77
  ret_val = nil
73
78
  Tempfile.open('docmago') do |f|
@@ -2,5 +2,6 @@ module DocmagoClient
2
2
  module Error
3
3
  class NoApiKeyProvidedError < RuntimeError; end
4
4
  class NoContentError < ArgumentError; end
5
+ class IntegrityCheckError < RuntimeError; end
5
6
  end
6
7
  end
@@ -1,3 +1,3 @@
1
1
  module DocmagoClient
2
- VERSION = '0.5.1'.freeze
2
+ VERSION = '0.5.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docmago_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Habermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-17 00:00:00.000000000 Z
11
+ date: 2016-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus