filepreviews 2.0.1 → 2.0.2
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/Changelog.md +6 -0
- data/README.md +13 -4
- data/lib/filepreviews/http.rb +2 -0
- data/lib/filepreviews/version.rb +1 -1
- data/spec/filepreviews/http_spec.rb +39 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ac89192a367b163454220c7ef4a0c963cbd4624
|
4
|
+
data.tar.gz: 11ed9bee9514ed5a265bd29ad7d3651f700b5c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73376d985dbe03617ad7cd0a2d70659431fde9189c4c47b006a474b8a0745d09286ac4eea910ff1e54513d8f60e31d4a6353adb5ba61bc8937b5ff609b45ebfa
|
7
|
+
data.tar.gz: 9c9e38337a939a76fe8cd1e6a4c87b7b9aededfb93715d6942b134105e1df13ad2464dd5b44e1e921de562778cff3e05eac22b1a574f1685de0d991dbaef6cb1
|
data/Changelog.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Filepreviews Changelog
|
2
2
|
|
3
|
+
## 2.0.2
|
4
|
+
|
5
|
+
Released Nov 12, 2016 ([2.0.2](https://github.com/jonahoffline/filepreviews-ruby/tree/v2.0.2)).
|
6
|
+
|
7
|
+
* Add `data` and `uploader` options (thanks to [macfanatic](https://github.com/macfanatic))
|
8
|
+
|
3
9
|
## 2.0.1
|
4
10
|
|
5
11
|
Released Sept 21, 2015 ([2.0.1](https://github.com/jonahoffline/filepreviews-ruby/tree/v2.0.1)).
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
[](https://gitter.im/jonahoffline/filepreviews-ruby)
|
7
7
|
[](http://inch-ci.org/github/jonahoffline/filepreviews-ruby)
|
8
8
|
|
9
|
-
|
9
|
+
Ruby client library and CLI tool for the [FilePreviews.io](http://filepreviews.io) service. Generate image previews and metadata from almost any kind of file.
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -23,9 +23,7 @@ Or install it yourself as:
|
|
23
23
|
$ gem install filepreviews
|
24
24
|
|
25
25
|
## Usage
|
26
|
-
|
27
|
-
|
28
|
-
For additional features and greater customization, register your application for an API key at [Filepreviews.io](http://bit.ly/filepreviews-signup)
|
26
|
+
Register your application for an API key at [FilePreviews.io](http://filepreviews.io).
|
29
27
|
|
30
28
|
### Configuration
|
31
29
|
To configure the gem to use your newly-registered `api + secret keys`, you can use one of the two configuration styles:
|
@@ -87,6 +85,17 @@ conf = {
|
|
87
85
|
# supported: 'jpg', 'jpeg', 'png'
|
88
86
|
format: 'jpg',
|
89
87
|
|
88
|
+
# Arbitrary key/value pairs that are returned in the "user_data" field in response
|
89
|
+
data: {
|
90
|
+
uuid: 'database_identifier'
|
91
|
+
},
|
92
|
+
|
93
|
+
# Support for specifying custom headers when the preview is placed in storage container
|
94
|
+
uploader: {
|
95
|
+
destination: 'directory/name',
|
96
|
+
headers: {} # common request headers to S3 bucket for instance
|
97
|
+
},
|
98
|
+
|
90
99
|
# supported: '1', '1-3', '1,3,5', '1-3', 'all'
|
91
100
|
pages: '1-3'
|
92
101
|
}
|
data/lib/filepreviews/http.rb
CHANGED
@@ -64,6 +64,8 @@ module Filepreviews
|
|
64
64
|
request = process_params(params)
|
65
65
|
request.store(:sizes, [extract_size(params.size)]) if params.size
|
66
66
|
request.store(:format, params.format) if params.format
|
67
|
+
request.store(:data, params.data) if params.data
|
68
|
+
request.store(:uploader, params.uploader) if params.uploader
|
67
69
|
request
|
68
70
|
end
|
69
71
|
|
data/lib/filepreviews/version.rb
CHANGED
@@ -48,4 +48,43 @@ describe Filepreviews::HTTP do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
describe '.prepare_request' do
|
53
|
+
let(:params) { OpenStruct.new(options) }
|
54
|
+
let(:request) { http.prepare_request(params) }
|
55
|
+
|
56
|
+
context 'when custom :data is provided' do
|
57
|
+
let(:options) do
|
58
|
+
{
|
59
|
+
url: 'testing.com',
|
60
|
+
uploader: { header: 'storage' },
|
61
|
+
data: { custom: :value }
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'includes the :data hash without changes' do
|
66
|
+
expect(request).to include(data: { custom: :value })
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'includes the :uploader hash without changes' do
|
70
|
+
expect(request).to include(uploader: { header: 'storage' })
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'when no custom :data is provided' do
|
75
|
+
let(:options) do
|
76
|
+
{
|
77
|
+
url: 'testing.com'
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'does not include the :data key' do
|
82
|
+
expect(request).not_to have_key(:data)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'does not include the :uploader key' do
|
86
|
+
expect(request).not_to have_key(:uploader)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
51
90
|
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.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonah Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-12 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.
|
136
|
+
rubygems_version: 2.5.1
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: FilePreviews.io Ruby library and CLI for the service
|