filestack-rails 2.1.0 → 2.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1f3cbfc96c33d255ffb170527ff78949bda896a
4
- data.tar.gz: 70d836e748adffc356bb29c2d0b3b36053c48bff
3
+ metadata.gz: e436b75ca4680f3ccede493fc75b62a6a74d99a3
4
+ data.tar.gz: dbe35e1ff3358ba778e5af1c42d18e332aec95c7
5
5
  SHA512:
6
- metadata.gz: 9176a5865055c079f5bdbffcebfef170ad5848e8f571b0ea2751c457c9c2c87ada8356673175144fc21d751a968cbee802140d1ad1e64fdb61b5aebbfda47b8a
7
- data.tar.gz: 5b6c5524f1e2bb9c27bbe00ad37317b80b23969f27dde7eaf356b903ffc1c00baccefea2e16b223203a7d5351dc54bd71eb942030a9230621bb736b78d5929cc
6
+ metadata.gz: b6f230f6317358ad641d5c0a9efbd6a82723d92c1a45fa5aca23a30caed3716d541fb90142a3343d91167b8dc68a76a15a94f550c9eb1caa8c683590c34051cc
7
+ data.tar.gz: 0b819bea2daa26e1e00e32c131c33de39c3fd2624fc8e29afa6d704a016e267b85445fef31aa2bb124245b1991e113cfea9a4c95492c50bd9d8771f11b5831f2
data/README.md CHANGED
@@ -6,12 +6,16 @@
6
6
 
7
7
  Adds form, image_tag, and download/save helpers to help you get up and running with [filestack.com](http://filestack.com) in Rails.
8
8
 
9
+ ## Note
10
+
11
+ This gem was previously named filepicker-rails (up to 2.1.0 version).
12
+
9
13
  ## Installation
10
14
 
11
15
  Add this line to your application's Gemfile:
12
16
 
13
17
  ```ruby
14
- gem 'filepicker-rails'
18
+ gem 'filestack-rails'
15
19
  ```
16
20
 
17
21
  And then execute:
@@ -20,7 +24,7 @@ And then execute:
20
24
 
21
25
  Or install it yourself as:
22
26
 
23
- $ gem install filepicker-rails
27
+ $ gem install filestack-rails
24
28
 
25
29
  Add the filestack.com javascript library to your layout:
26
30
 
@@ -182,11 +186,11 @@ Please see [CONTRIBUTING.md](https://github.com/filestack/filepicker-rails/blob/
182
186
 
183
187
  Thank you to all the [contributors](https://github.com/filestack/filepicker-rails/graphs/contributors).
184
188
 
185
- [gem_version_badge]: https://badge.fury.io/rb/filepicker-rails.png
186
- [ruby_gems]: http://rubygems.org/gems/filepicker-rails
187
- [travis_ci]: http://travis-ci.org/Ink/filepicker-rails
188
- [travis_ci_badge]: https://travis-ci.org/Ink/filepicker-rails.svg?branch=master
189
- [code_climate]: https://codeclimate.com/github/Ink/filepicker-rails
190
- [code_climate_badge]: https://codeclimate.com/github/Ink/filepicker-rails.png
191
- [coveralls]: https://coveralls.io/r/Ink/filepicker-rails
192
- [coveralls_badge]: https://coveralls.io/repos/Ink/filepicker-rails/badge.png?branch=master
189
+ [gem_version_badge]: https://badge.fury.io/rb/filestack-rails.svg
190
+ [ruby_gems]: http://rubygems.org/gems/filestack-rails
191
+ [travis_ci]: http://travis-ci.org/filestack/filestack-rails
192
+ [travis_ci_badge]: https://travis-ci.org/filestack/filestack-rails.svg?branch=master
193
+ [code_climate]: https://codeclimate.com/github/filestack/filestack-rails
194
+ [code_climate_badge]: https://codeclimate.com/github/filestack/filestack-rails.png
195
+ [coveralls]: https://coveralls.io/r/filestack/filestack-rails
196
+ [coveralls_badge]: https://coveralls.io/repos/filestack/filestack-rails/badge.png?branch=master
@@ -37,6 +37,7 @@ module FilepickerRails
37
37
  # - `:open_to` - Open the picker to the given service. Ex: `COMPUTER`.
38
38
  # - `:class` - Add a class to the input.
39
39
  # - `:value` - Define the value of the input
40
+ # - `:language` - Open the picker to the given language. Ex: `fr`.
40
41
  #
41
42
  # #### Examples
42
43
  #
@@ -163,6 +164,10 @@ module FilepickerRails
163
164
  #
164
165
  # - `:cache` - Specifies if the image should be cached or not.
165
166
  #
167
+ # - `:compress` - You can take advantage of Filepicker's image compression which utilizes JPEGtran and OptiPNG.
168
+ # The value for this parameter is boolean. If you want to compress your image then the parameter
169
+ # is compress:true. Compression is off/false by default.
170
+ #
166
171
  # #### Examples
167
172
  #
168
173
  # filepicker_image_url @user.filepicker_url, w: 160, h: 160, fit: 'clip'
@@ -177,7 +182,7 @@ module FilepickerRails
177
182
  CONVERT_OPTIONS = [:w, :h, :fit, :align, :rotate, :crop, :format,
178
183
  :quality, :watermark, :watersize, :waterposition,
179
184
  :crop_first]
180
- VALID_OPTIONS = CONVERT_OPTIONS + [:cache]
185
+ VALID_OPTIONS = CONVERT_OPTIONS + [:cache, :compress]
181
186
 
182
187
  def initialize(url, options = {})
183
188
  @url, @options = url, options
@@ -229,8 +234,12 @@ module FilepickerRails
229
234
  end
230
235
  end
231
236
 
237
+ def handle
238
+ url.split("/").last
239
+ end
240
+
232
241
  def policy_config
233
- Policy.apply
242
+ Policy.apply(options: {handle: handle})
234
243
  end
235
244
 
236
245
  def url_with_path
@@ -258,9 +267,9 @@ module FilepickerRails
258
267
  options[:data]['fp-url'] = url
259
268
  options[:data]['fp-apikey'] = ::Rails.application.config.filepicker_rails.api_key
260
269
  options[:data]['fp-mimetype'] = mimetype
261
- options[:data]['fp-option-container'] = container if container
262
- options[:data]['fp-option-services'] = Array(services).join(",") if services
263
- options[:data]['fp-option-defaultSaveasName'] = save_as if save_as
270
+ options[:data]['fp-container'] = container if container
271
+ options[:data]['fp-services'] = Array(services).join(",") if services
272
+ options[:data]['fp-suggestedFilename'] = save_as if save_as
264
273
  block.call
265
274
  end
266
275
  end
@@ -27,6 +27,7 @@ module FilepickerRails
27
27
  # - `:open_to` - Open the picker to the given service. Ex: `COMPUTER`.
28
28
  # - `:class` - Add a class to the input.
29
29
  # - `:value` - Define the value of the input
30
+ # - `:language` - Open the picker to the given language. Ex: `fr`.
30
31
  #
31
32
  # #### Examples
32
33
  #
@@ -10,7 +10,7 @@ module FilepickerRails
10
10
 
11
11
  initializer 'filepicker_rails.action_controller' do |app|
12
12
  ActiveSupport.on_load(:action_controller) do
13
- helper FilepickerRails::ApplicationHelper
13
+ ::ActionController::Base.helper(FilepickerRails::ApplicationHelper)
14
14
  end
15
15
  end
16
16
  end
@@ -19,9 +19,9 @@ module FilepickerRails
19
19
  OpenSSL::HMAC.hexdigest('sha256', ::Rails.application.config.filepicker_rails.secret_key, policy)
20
20
  end
21
21
 
22
- def self.apply(call = [:read, :convert], keys = ['policy', 'signature'])
22
+ def self.apply(call: [:read, :convert], keys: ['policy', 'signature'], options: {})
23
23
  return {} unless ::Rails.application.config.filepicker_rails.secret_key.present?
24
- grant = Policy.new
24
+ grant = Policy.new(options)
25
25
  grant.call = call
26
26
  {
27
27
  keys[0] => grant.policy,
@@ -8,10 +8,9 @@ module FilepickerRails
8
8
  :store_location, :store_access,
9
9
  :store_container, :multiple]
10
10
 
11
- FILEPICKER_OPTIONS_TO_CAMELIZE = [:max_size, :max_files, :open_to]
11
+ FILEPICKER_OPTIONS_TO_CAMELIZE = [:max_size, :max_files, :open_to, :language]
12
12
 
13
13
  private
14
-
15
14
  attr_reader :input_options, :type
16
15
 
17
16
  def define_input_options(options)
@@ -39,7 +38,7 @@ module FilepickerRails
39
38
  end
40
39
 
41
40
  def secure_filepicker
42
- Policy.apply([:pick, :store], ['data-fp-policy', 'data-fp-signature'])
41
+ Policy.apply(call: [:pick, :store], keys: ['data-fp-policy', 'data-fp-signature'])
43
42
  end
44
43
  end
45
44
  end
@@ -1,3 +1,3 @@
1
1
  module FilepickerRails
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filestack-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filestack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-05 00:00:00.000000000 Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -138,7 +138,7 @@ dependencies:
138
138
  version: '0'
139
139
  description: Makes integrating Filestack with rails easy
140
140
  email:
141
- - contact@filestack.com
141
+ - dev@filestack.com
142
142
  executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []