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 +4 -4
- data/Changelog.md +6 -0
- data/lib/filepreviews.rb +6 -2
- data/lib/filepreviews/utils.rb +8 -9
- data/lib/filepreviews/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: 10efb95f96a23631dd0d3380b8c05fee1845644f
|
4
|
+
data.tar.gz: cfed3e9f94fb1f99e3734646066ec5c34abe17a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
47
|
-
|
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)
|
data/lib/filepreviews/utils.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
48
|
-
|
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
|
data/lib/filepreviews/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|