convert_api 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/convert_api.rb +2 -1
- data/lib/convert_api/format_detector.rb +0 -5
- data/lib/convert_api/task.rb +3 -1
- data/lib/convert_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e44a0cc4e78a77d29b9350803511570102bba4f
|
|
4
|
+
data.tar.gz: 11ff7d02a2027457ce7f9f41fce982195635a7a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53ef63fda80f3dd8052a365d2614d17166b4eac92ff9eac35426e04d1d2fe0635f2e03067654792e84c2f41ced3097ad2155b3130ed94f2fccc0196da71249b9
|
|
7
|
+
data.tar.gz: e7f3fc26b766252a4e15e7a901335f1f3974cb8938965e374de44d0fb8a0779f9f0c6767d48f4b3291c372cf43d041a8302e281adb78f174b51ffa5693e45b09
|
data/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
# ConvertAPI Ruby Client
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
[](https://rubygems.org/gems/convert_api)
|
|
5
|
+
[](http://travis-ci.org/ConvertAPI/convertapi-ruby)
|
|
6
|
+
|
|
2
7
|
## Convert your files with our online file conversion API
|
|
3
8
|
|
|
4
9
|
The ConvertAPI helps converting various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files. And many others files manipulations. In just few minutes you can integrate it into your application and use it easily.
|
data/lib/convert_api.rb
CHANGED
|
@@ -11,6 +11,7 @@ require 'convert_api/format_detector'
|
|
|
11
11
|
|
|
12
12
|
module ConvertApi
|
|
13
13
|
URI_REGEXP = URI::regexp(%w(http https))
|
|
14
|
+
DEFAULT_URL_FORMAT = 'url'
|
|
14
15
|
|
|
15
16
|
module_function
|
|
16
17
|
|
|
@@ -31,6 +32,6 @@ module ConvertApi
|
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
def client
|
|
34
|
-
|
|
35
|
+
Thread.current[:convert_api_client] ||= Client.new
|
|
35
36
|
end
|
|
36
37
|
end
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
module ConvertApi
|
|
2
2
|
class FormatDetector
|
|
3
|
-
DEFAULT_URL_FORMAT = 'url'
|
|
4
|
-
|
|
5
3
|
def initialize(resource)
|
|
6
4
|
@resource = resource
|
|
7
5
|
end
|
|
8
6
|
|
|
9
7
|
def run
|
|
10
8
|
extension = File.extname(path).downcase
|
|
11
|
-
|
|
12
|
-
return DEFAULT_URL_FORMAT if extension.empty? && @resource =~ URI_REGEXP
|
|
13
|
-
|
|
14
9
|
format = extension[1..-1]
|
|
15
10
|
|
|
16
11
|
raise(FormatError, 'Unable to detect format') if format.nil?
|
data/lib/convert_api/task.rb
CHANGED
|
@@ -61,7 +61,9 @@ module ConvertApi
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def detect_format(params)
|
|
64
|
-
|
|
64
|
+
return DEFAULT_URL_FORMAT if params[:Url]
|
|
65
|
+
|
|
66
|
+
resource = params[:File] || Array(params[:Files]).first
|
|
65
67
|
|
|
66
68
|
FormatDetector.new(resource).run
|
|
67
69
|
end
|
data/lib/convert_api/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: convert_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomas Rutkauskas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-06-
|
|
11
|
+
date: 2018-06-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|