hypdf 1.0.17 → 1.0.18

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: 99d5442f0715a1184158048b3e0a249b688b45a3
4
- data.tar.gz: 8b1bf97d29b558e21947c402c35414c4394ddcc1
3
+ metadata.gz: 6e066724873f784d1710cee05542f694011f124f
4
+ data.tar.gz: a38a38a3a5a1b9cbac6fe701a86c5c6d1e0499da
5
5
  SHA512:
6
- metadata.gz: d2ad57b1abec6bc2b78fde27b51ab64ba4e59b8fadb307684f213d5f06d5932ae9aa2c87a3f69e27d14b9227d91d8d7a8c450f11b78b2eda38df2bb68a9952f7
7
- data.tar.gz: c6417274d01f29fff0be2cc7b4337dda03bda15e4478803a4b1dd2243b5249e1946d4d95bb33b4e313376614979c98a1d1a0c67df7da7771e20a14b2f013adb0
6
+ metadata.gz: 5f66c8186c7815b4afdff88de25caf7ad84de449031fdc39f63c12a890e7102c12502336b7317a7a7ffe1cc7dfdaf8f5cec0a5054605ceecee0b75f980e5e62a
7
+ data.tar.gz: e55a03e82033891ddec230d065f33a70ef20d9b25b4be25cc6623dec4953bbdfd6a130b7770a9c7e5a05d53c2e321751cfbef7e801b69d6def1692bcbb41d3ba
@@ -1,5 +1,6 @@
1
- require "json"
2
- require "hypdf/exceptions"
1
+ require 'json'
2
+ require 'hypdf/exceptions'
3
+ require 'hypdf/composite_io'
3
4
  require 'httparty'
4
5
 
5
6
  class HyPDF
@@ -0,0 +1,57 @@
1
+ #--
2
+ # Origin: https://raw.githubusercontent.com/nicksieger/multipart-post/master/lib/composite_io.rb
3
+ # Copyright (c) 2007-2012 Nick Sieger.
4
+ #++
5
+
6
+ # Convenience methods for dealing with files and IO that are to be uploaded.
7
+ class UploadIO
8
+ # Create an upload IO suitable for including in the params hash of a
9
+ # Net::HTTP::Post::Multipart.
10
+ #
11
+ # Can take two forms. The first accepts a filename and content type, and
12
+ # opens the file for reading (to be closed by finalizer).
13
+ #
14
+ # The second accepts an already-open IO, but also requires a third argument,
15
+ # the filename from which it was opened (particularly useful/recommended if
16
+ # uploading directly from a form in a framework, which often save the file to
17
+ # an arbitrarily named RackMultipart file in /tmp).
18
+ #
19
+ # Usage:
20
+ #
21
+ # UploadIO.new("file.txt", "text/plain")
22
+ # UploadIO.new(file_io, "text/plain", "file.txt")
23
+ #
24
+ attr_reader :content_type, :original_filename, :local_path, :io, :opts, :path
25
+
26
+ def initialize(filename_or_io, content_type, filename = nil, opts = {})
27
+ io = filename_or_io
28
+ local_path = ""
29
+ if io.respond_to? :read
30
+ # in Ruby 1.9.2, StringIOs no longer respond to path
31
+ # (since they respond to :length, so we don't need their local path, see parts.rb:41)
32
+ local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : filename
33
+ else
34
+ io = File.open(filename_or_io)
35
+ local_path = filename_or_io
36
+ end
37
+ filename ||= local_path
38
+
39
+ @content_type = content_type
40
+ @original_filename = File.basename(filename)
41
+ @local_path = @path = local_path
42
+ @io = io
43
+ @opts = opts
44
+ end
45
+
46
+ def self.convert!(io, content_type, original_filename, local_path)
47
+ raise ArgumentError, "convert! has been removed. You must now wrap IOs using:\nUploadIO.new(filename_or_io, content_type, filename=nil)\nPlease update your code."
48
+ end
49
+
50
+ def method_missing(*args)
51
+ @io.send(*args)
52
+ end
53
+
54
+ def respond_to?(meth, include_all = false)
55
+ @io.respond_to?(meth, include_all) || super(meth, include_all)
56
+ end
57
+ end
@@ -1,3 +1,3 @@
1
1
  class HyPDF
2
- VERSION = "1.0.17"
2
+ VERSION = "1.0.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hypdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - redfield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-09 00:00:00.000000000 Z
11
+ date: 2018-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -53,6 +53,7 @@ files:
53
53
  - Rakefile
54
54
  - hypdf.gemspec
55
55
  - lib/hypdf.rb
56
+ - lib/hypdf/composite_io.rb
56
57
  - lib/hypdf/exceptions.rb
57
58
  - lib/hypdf/version.rb
58
59
  - spec/hypdf_spec.rb