convert_api 1.3.0 → 1.3.1

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
  SHA256:
3
- metadata.gz: 9824a625f3ec5b42ce47ea1730fca1ee3b7c93328b80dfffb14837c66462e881
4
- data.tar.gz: 3202cc2beb89b94779bf1db6b10208c9b49a3882060139d7f3c6cdd11bce7616
3
+ metadata.gz: a32b7ed931b291534f117094b1e4ae376bd85435bdd4da624f491db402a873c8
4
+ data.tar.gz: 3da43e3aefecb611eece8f304dcba9a2392bfa290654244d057d0454258b1dff
5
5
  SHA512:
6
- metadata.gz: 5029ec5772731a0fc7c738a0eb7be491c7edae9d8599380b1ca24a71e3106d793b5d2d45c2a73102cd2bbb2fafb755b0caba5a30bf88901c11cecb59a97336af
7
- data.tar.gz: '09038006737a8e5ad3e47da2e818623de96ac0e42ffb208bbc5e74434258f213c52b7c143daa4c88011e16c1a8126fd889d268666a24eba3b9be1fbe3254000b'
6
+ metadata.gz: eb00e76bf1cb9ff0635b25be1d105048d300a15846b2c2672e523e6fcf3ce8b3d97cac3e6ef184ef044b26d51176b35e42618fec788c9f3bcb479efe18e0faff
7
+ data.tar.gz: 1893489362ed8dad54b8e9909f4435e687878e9fb03ecb84aebc46f9e728f1eac06a1dbc999332a95e3b6173c21f4e45bfa58517294060c1162be29edc317738
@@ -0,0 +1,26 @@
1
+ name: Build
2
+ on: [push,pull_request]
3
+ jobs:
4
+ build:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ ruby-version:
9
+ - 2.0
10
+ - 2.6
11
+ - 2.7
12
+ - 3.0
13
+ - ruby-head
14
+ - jruby-9.1
15
+ - jruby-head
16
+ name: Ruby ${{ matrix.ruby-version }} sample
17
+ steps:
18
+ - uses: actions/checkout@v3
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby-version }}
22
+ # bundler-cache: true
23
+ - run: bundle install
24
+ - env:
25
+ CONVERT_API_SECRET: ${{ secrets.CONVERTAPI_SECRET }}
26
+ run: bundle exec rake spec
data/README.md CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
 
4
4
  [![Gem](https://img.shields.io/gem/v/convert_api.svg)](https://rubygems.org/gems/convert_api)
5
- [![Build Status](https://secure.travis-ci.org/ConvertAPI/convertapi-ruby.svg)](http://travis-ci.org/ConvertAPI/convertapi-ruby)
5
+ [![Build Status](https://github.com/ConvertAPI/convertapi-ruby/actions/workflows/main.yml/badge.svg)](https://github.com/ConvertAPI/convertapi-ruby/actions)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+
6
8
 
7
9
  ## Convert your files with our online file conversion API
8
10
 
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.
11
+ ConvertAPI helps in 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 other file manipulations. You can integrate it into your application in just a few minutes and use it easily.
10
12
 
11
13
 
12
14
  ## Installation
@@ -97,7 +99,7 @@ puts result.files[0].size
97
99
 
98
100
  ### User information
99
101
 
100
- You can always check remaining seconds amount by fetching [user information](https://www.convertapi.com/doc/user).
102
+ You can always check your remaining seconds programmatically by fetching [user information](https://www.convertapi.com/doc/user).
101
103
 
102
104
  ```ruby
103
105
  user_info = ConvertApi.user
@@ -107,7 +109,7 @@ puts user_info['SecondsLeft']
107
109
 
108
110
  ### More examples
109
111
 
110
- You can find more advanced examples in the [examples/](https://github.com/ConvertAPI/convertapi-ruby/tree/master/examples) folder.
112
+ Find more advanced examples in the [examples/](https://github.com/ConvertAPI/convertapi-ruby/tree/master/examples) folder.
111
113
 
112
114
 
113
115
  ## Development
@@ -1,21 +1,28 @@
1
1
  module ConvertApi
2
2
  class FormatDetector
3
- def initialize(resource)
3
+ ANY_FORMAT = 'any'
4
+
5
+ def initialize(resource, to_format)
4
6
  @resource = resource
7
+ @to_format = to_format
5
8
  end
6
9
 
7
10
  def run
11
+ return ANY_FORMAT if archive?
8
12
  return @resource.file_ext.downcase if @resource.is_a?(UploadIO)
9
13
 
10
- format_from_path
14
+ format_from_path || raise(FormatError, 'Unable to detect format')
11
15
  end
12
16
 
13
17
  private
14
18
 
19
+ def archive?
20
+ @to_format.to_s.downcase == 'zip'
21
+ end
22
+
15
23
  def format_from_path
16
24
  extension = File.extname(path).downcase
17
- format = extension[1..-1]
18
- format || raise(FormatError, 'Unable to detect format')
25
+ extension[1..-1]
19
26
  end
20
27
 
21
28
  def path
@@ -66,7 +66,7 @@ module ConvertApi
66
66
 
67
67
  resource = params[:File] || Array(params[:Files]).first
68
68
 
69
- FormatDetector.new(resource).run
69
+ FormatDetector.new(resource, @to_format).run
70
70
  end
71
71
 
72
72
  def config
@@ -1,3 +1,3 @@
1
1
  module ConvertApi
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
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.3.0
4
+ version: 1.3.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: 2020-08-30 00:00:00.000000000 Z
11
+ date: 2022-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -62,10 +62,10 @@ executables: []
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
+ - ".github/workflows/main.yml"
65
66
  - ".gitignore"
66
67
  - ".rspec"
67
68
  - ".ruby-version"
68
- - ".travis.yml"
69
69
  - Gemfile
70
70
  - LICENSE.txt
71
71
  - README.md
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.1.0
5
- - 2.2.0
6
- - 2.3.0
7
- - 2.4.1
8
- - 2.5.1
9
- - 2.6.5
10
- - 2.7.0
11
- - jruby-head
12
- bundler_args: --jobs=3 --retry=3 --binstubs
13
- env:
14
- global:
15
- secure: Pri+nCT6ayGYkjGO/WfMGkqk4DBKseJjQuWHWdft9YH2G+5dc7UKypDqmlfZvqwLPw2kybepKfh/utRGYsL5nfbET+3Ml8+2Bgaf0IT4Ej/3B5KIdFbivHmRp/NP/Dgh64M+5u1wKEEnw1NIMHwcanQDzPUDtaxqsw1xwowUL5Axr+UnJtWL2bP/RCED2JEgwhBQBFSMBXXwpSK2yFT7X1pInPWX2S0hELxj1UDefLDjp6kEnkrU/u+FjC9RhmYhusx2muXC4pHiqdNL0fDZStgginAQAd92FsMHQyzwewefCGRAg0g25ZmSGx5cHL4BZORdUnxaG9+AS9Wt17tZI2WS9eUBc9yyRU+R76aSo79uJj4RKi1Ljd3+4fyI/9BDz9a2koEgeDbYUHHf0dYaFSLXcOpnLBBPtr0qD02SUP1EcYTOe1/sNMweDLfN67E70YV69+ZqQeb+xgCbAeeoTOGJ9uKR2c91wSZwDjpTXXSLrNeNw98FPRyWxpfRRFQV29ZDPx/cfHt9gAVQVnd+ZBCAFwr353nqE8Ux1wtrxkexPkT8G+TXIgTvvYDfu2WmaO7qrZR2D6427jc4sgndwWfSPgiLw4eW1u3hCyaCnPBsviugtj1sTs2NfnLPdgtSUcKBd4xNbbVQoqZM1qTL139HvpZFB+jD8uoVtgWigUA=