filepreviews 2.0.0 → 2.0.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
  SHA1:
3
- metadata.gz: 546e8d302d532f3d59e47303370a194f098095be
4
- data.tar.gz: 5e68cfdc503bb10fd36b0ed7f7e87f55c99093f6
3
+ metadata.gz: 10efb95f96a23631dd0d3380b8c05fee1845644f
4
+ data.tar.gz: cfed3e9f94fb1f99e3734646066ec5c34abe17a4
5
5
  SHA512:
6
- metadata.gz: ebd3b87732db306fc5849a5009bbe6855fe70a0efba217fddf01846006a63368e39ac7fa1df5c43d444d8e7e352362b388b954cda471c119e7941e8f3797dd33
7
- data.tar.gz: 484ac6d498dffd8444f4d701d9ee5ec4d935bce614e814978b341560c2126299acaa4a8bda8700627623712a510578dd49d123e2922dd4984184c8f46e8e674d
6
+ metadata.gz: 683b1fd6f352a3c1e0389cb304d4be12bea4f117cf2f68d8042b2288b67c88362631922307ecc1ac2482d972c8e530bd0dd03edde77d759eb7b3d50ff6ea9274
7
+ data.tar.gz: 6a530b23acb8638a21d98e29f28c3da6ccc9612155b9e98deef00b2f2773af938335063020652ca548bcd1240587c1edcba945aa1311972a8080a5f33979296c
data/Changelog.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Filepreviews Changelog
2
2
 
3
+ ## 2.0.1
4
+
5
+ Released Sept 21, 2015 ([2.0.1](https://github.com/jonahoffline/filepreviews-ruby/tree/v2.0.1)).
6
+
7
+ * Remove default `exif` `metadata` option
8
+
3
9
  ## 2.0.0
4
10
 
5
11
  Released Sept 17, 2015 ([2.0.0](https://github.com/jonahoffline/filepreviews-ruby/tree/v2.0.0)).
data/lib/filepreviews.rb CHANGED
@@ -6,6 +6,7 @@ require 'filepreviews/http'
6
6
  require 'filepreviews/response'
7
7
  require 'ostruct'
8
8
 
9
+
9
10
  # @author Jonah Ruiz <jonah@pixelhipsters.com>
10
11
  # Main module for FilePreviews.io library
11
12
  module Filepreviews
@@ -43,8 +44,11 @@ module Filepreviews
43
44
  # Merges metadata options with supported formats
44
45
  # @param options [Hash<symbol>] metadata and optional size
45
46
  def self.merge_options(options)
46
- metadata = (options.fetch(:metadata, ['exif']) & metadata_formats)
47
- options.store(:metadata, metadata) unless metadata.empty?
47
+ options.delete(:metadata) if options[:metadata] && options[:metadata].empty?
48
+
49
+ if metadata_formats.include?(options[:metadata])
50
+ options.store(:metadata, options[:metadata])
51
+ end
48
52
 
49
53
  image = (options.fetch(:format) if image_formats.include?(options[:format]))
50
54
  options.store(:format, image)
@@ -13,11 +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
- if metadata.class.eql?(Array)
17
- metadata.join(',')
18
- else
19
- metadata
20
- end
16
+ metadata.join(',')
21
17
  end
22
18
 
23
19
  # Validates page parameters
@@ -43,10 +39,13 @@ module Filepreviews
43
39
  # @param params [Hash<Symbol>] :url and :metadata
44
40
  # @return [Hash<Symbol>] processed parameters for http request
45
41
  def process_params(params)
46
- {
47
- url: CGI.unescape(params.url),
48
- metadata: [extract_metadata(params.metadata)]
49
- }
42
+ parameters = { url: CGI.unescape(params.url) }
43
+
44
+ if params.metadata
45
+ parameters[:metadata] = [extract_metadata(params.metadata)]
46
+ end
47
+
48
+ parameters
50
49
  end
51
50
  end
52
51
  end
@@ -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.0'
4
+ VERSION = '2.0.1'
5
5
  end
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.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonah Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-17 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler