filepreviews 2.0.3 → 2.0.4

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: f12bf824314da70b46ba5b3bfb889e967747c407
4
- data.tar.gz: 54d4d020ff9b94540976b1da34b1b8d41c694566
3
+ metadata.gz: 1b304050508dcdd255e7971404a4ff4ff732b906
4
+ data.tar.gz: dd3c909fd13ee4da6cedd4b4abb3a07ee8fbe64c
5
5
  SHA512:
6
- metadata.gz: 03b7c6ece770ee470428752bfece08eb324c90830b51738070662c1b26ec276b04811dc46778cb59b8b65dce3aa09fe60f167c51216c744508db7691a9464db7
7
- data.tar.gz: 99fca5538f130fd2b0e5e8b420ad72d6121e3ca866aca0b7020eaf8f429d489002c53014ae8e6cdae5d36c9713cce8bc1a23c696843900292bd717b0b60df748
6
+ metadata.gz: b8c4560ee25bb02cc0dc88c2041ec9b120879e00260c2d4d161310567ab751f1cff4bd21f7c48c6e9e18d651236434676f02fdc5e26e59a7b498848a9c29eac5
7
+ data.tar.gz: e229141bacbded9042f5bc88e2469cffb1ec71f8dd6cce8a01c47c0be1481b3b887a72639c80af836c87b8db9ca9ad6453bd4613b36c739865fef692507b96e6
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.1.1
1
+ ruby-2.4.1
data/.travis.yml CHANGED
@@ -7,13 +7,6 @@ rvm:
7
7
  - 2.1.1
8
8
  - 2.0.0
9
9
  script: bundle exec rake test
10
- notifications:
11
- email: false
12
- irc:
13
- on_success: change
14
- on_failure: always
15
- channels:
16
- - irc.freenode.org#rubyonadhd
17
10
  env:
18
11
  global:
19
12
  - secure: ksz/xSq5EkiWQfclYHh5gj32IjqH5uTXacYqFGZdpZWPtkxGscSVeBzAvGtY9IQddkEuobVEW8TBqPo2rZ+7sT6ZfLQOuNM9Vtw5jDbAifyHLivZ5/acnW7m5BcmkxttKrel4DfRexzvGW6SAweE+fC07BLfPjzyKoIyjKnV4Y8=
data/Changelog.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Filepreviews Changelog
2
2
 
3
+ ## 2.0.4
4
+
5
+ Released May 4, 2018 ([2.0.4](https://github.com/jonahoffline/filepreviews-ruby/tree/v2.0.4)).
6
+
7
+ * Fix `metadata` options (thanks to [itay-grudev](https://github.com/itay-grudev))
8
+
3
9
  ## 2.0.3
4
10
 
5
11
  Released August 5, 2017 ([2.0.3](https://github.com/jonahoffline/filepreviews-ruby/tree/v2.0.3)).
@@ -13,7 +13,7 @@ module Filepreviews
13
13
  # @param metadata [Array] image formats
14
14
  # @return [String] metadata url parameters
15
15
  def extract_metadata(metadata)
16
- metadata.join(',')
16
+ metadata.to_a
17
17
  end
18
18
 
19
19
  # Validates page parameters
@@ -42,7 +42,7 @@ module Filepreviews
42
42
  parameters = { url: CGI.unescape(params.url) }
43
43
 
44
44
  if params.metadata
45
- parameters[:metadata] = [extract_metadata(params.metadata)]
45
+ parameters[:metadata] = extract_metadata(params.metadata)
46
46
  end
47
47
 
48
48
  parameters
@@ -1,5 +1,5 @@
1
1
  # @author Jonah Ruiz <jonah@pixelhipsters.com>
2
2
  # Contains the version namespaced
3
3
  module Filepreviews
4
- VERSION = '2.0.3'
4
+ VERSION = '2.0.4'
5
5
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Filepreviews do
4
4
  let(:file_previews) { Filepreviews }
5
- let(:sample_img) { 'http://pixelhipsters.com/images/pixelhipster_cat.png' }
5
+ let(:sample_img) { 'https://filepreviews.io/img/filepreviews-logo.svg' }
6
6
 
7
7
  it 'keeps it real, you feels me dawg?' do
8
8
  expect(true).to eq(true)
@@ -30,15 +30,32 @@ describe Filepreviews do
30
30
  end
31
31
 
32
32
  context 'when used with an api key' do
33
- it 'returns a Filepreviews::Response instance' do
33
+ before(:each) do
34
34
  Filepreviews.api_key = ENV['FILEPREVIEWS_API_KEY']
35
35
  Filepreviews.secret_key = ENV['FILEPREVIEWS_SECRET_KEY']
36
+ end
37
+
38
+ it 'returns a Filepreviews::Response instance' do
36
39
  response = file_previews.generate(sample_img)
37
40
 
38
41
  expect(response.url).to_not be_nil
39
42
  expect(response.id).to_not be_nil
40
43
  expect(response).to be_an_instance_of(Filepreviews::Response)
41
44
  end
45
+
46
+ context 'with additional metadata' do
47
+ it 'returns a Filepreviews::Response instance' do
48
+ response = file_previews.generate(sample_img, {
49
+ options: {
50
+ metadata: [ 'ocr', 'psd', 'exif', 'sketch', 'webpage', 'checksum', 'multimedia' ]
51
+ }
52
+ })
53
+
54
+ expect(response.url).to_not be_nil
55
+ expect(response.id).to_not be_nil
56
+ expect(response).to be_an_instance_of(Filepreviews::Response)
57
+ end
58
+ end
42
59
  end
43
60
 
44
61
  context 'when used with an incorrect api key' do
@@ -25,6 +25,16 @@ describe Filepreviews::Utils do
25
25
  end
26
26
  end
27
27
 
28
+ describe '.extract_metadata' do
29
+ it 'returns one metadata entry as an array' do
30
+ expect(Kawaii.new.extract_metadata([:psd])).to eq([:psd])
31
+ end
32
+
33
+ it 'returns multipe metadata entries as an array' do
34
+ expect(Kawaii.new.extract_metadata([:psd, :ocr])).to eq([:psd, :ocr])
35
+ end
36
+ end
37
+
28
38
  describe '.validate_pages' do
29
39
  context 'when called with range parameters (1-3)' do
30
40
  it 'validates page parameters' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filepreviews
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonah Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-06 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.4.8
136
+ rubygems_version: 2.6.12
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: FilePreviews.io Ruby library and CLI for the service