transloadit-rails 1.1.2 → 1.2.0

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: 8ef397b0d10de134321224d92d3a426778fbce69
4
- data.tar.gz: e31f915796467893c049dc607f603eef9b35d77c
3
+ metadata.gz: 9e46058e6c8e5bcfe204b3b88c65dbf785b1d3fe
4
+ data.tar.gz: f55864e9016db5bb63c66629364fe05e52838002
5
5
  SHA512:
6
- metadata.gz: 1940de380e945a81307e602ccba9cbf79ffcfd36799d43b6e66b5b273e00f02f48c9daa736325ca0371f26fccdcb39ea5924ccfe2d81094ab3aa0511101189ed
7
- data.tar.gz: 887e3c953dff1f8faaf9a40a45956583f83c45724ddfd1e76c89c6f4356d73561f79e4df60777fded5af699a0ad8c613ac51fff55eb1a042fb6d028c2d5f0c60
6
+ metadata.gz: e4085ab14244992ac22ab3145bf4efbdbb9df4ffa475215cc1734d7c7c4a5b82407765b615c311aca15756c1787d04b380adc9d2fb0438273352ac8ebbe9cb16
7
+ data.tar.gz: 1ffcf1c1976bf9d9db1ed6d33aa6abc855ecae065cda4e1eb04bdbe3a1329bdad5f2ee5bfa10d4c2c98f38476a81405f28c604835193df136b75fbe0ac741efb
data/.gitignore CHANGED
@@ -8,5 +8,6 @@ Gemfile.lock
8
8
  coverage
9
9
  doc
10
10
  pkg
11
+ transloadit-rails-*.gem
11
12
 
12
13
  test/tmp
@@ -5,9 +5,10 @@ rvm:
5
5
  - 2.0.0
6
6
  - 2.1.0
7
7
  - 2.2.0
8
- - 2.3.0-preview1
8
+ - 2.3.0
9
9
  - rbx-2
10
10
  - jruby-19mode
11
+ - jruby-9.0.0.0
11
12
  script: "bundle exec rake test"
12
13
 
13
14
  gemfile:
@@ -1,3 +1,7 @@
1
+ ### 1.2.0 / 2016-03-27 ###
2
+
3
+ * Allow to pass `max_size` to the helper (thanks @avokhmin)
4
+
1
5
  ### 1.1.2 / 2015-12-15 ###
2
6
 
3
7
  * Allow `onFileSelect` callback (thanks @netonion)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2015 Transloadit Ltd.
3
+ Copyright (c) 2016 Transloadit Ltd.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
@@ -45,25 +45,38 @@ class Transloadit
45
45
  #
46
46
  # Returns the Transloadit authentication object.
47
47
  #
48
- def self.transloadit
48
+ # options - The Hash options used to refine the auth params (default: {}):
49
+ # :max_size - The Integer maximum size an upload can have in bytes (optional).
50
+ def self.transloadit(options = {})
49
51
  Transloadit.new(
50
52
  :key => self.configuration['auth']['key'],
51
53
  :secret => self.configuration['auth']['secret'],
52
54
  :duration => self.configuration['auth']['duration'],
53
- :max_size => self.configuration['auth']['max_size']
55
+ :max_size => options[:max_size] || self.configuration['auth']['max_size']
54
56
  )
55
57
  end
56
58
 
57
59
  #
58
60
  # Creates an assembly for the named template.
59
61
  #
62
+ # name - The String or Symbol template name.
63
+ # options - The Hash options used to refine the Assembly (default: {}):
64
+ # :steps - The Hash with Assembly Steps (optional).
65
+ # :max_size - The Integer maximum size an upload can have in bytes (optional).
60
66
  def self.template(name, options = {})
67
+ transloadit = self.transloadit(
68
+ :max_size => options.delete(:max_size)
69
+ )
70
+
61
71
  template = self.configuration['templates'].try(:fetch, name.to_s)
72
+ assembly_options = case template
73
+ when String
74
+ { :template_id => template }.merge(options)
75
+ when Hash
76
+ template.merge(options)
77
+ end
62
78
 
63
- self.transloadit.assembly case template
64
- when String then { :template_id => template }.merge(options)
65
- when Hash then template .merge(options)
66
- end
79
+ transloadit.assembly(assembly_options)
67
80
  end
68
81
 
69
82
  #
@@ -1,5 +1,5 @@
1
1
  class Transloadit
2
2
  module Rails
3
- VERSION = '1.1.2'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -5,6 +5,10 @@ module Transloadit::Rails::ViewHelper
5
5
  # Inserts hidden fields specifying and signing the template for Transloadit
6
6
  # to process.
7
7
  #
8
+ # template - The String or Symbol template name.
9
+ # options - The Hash options used to refine the Assembly (default: {}):
10
+ # :steps - The Hash with Assembly Steps (optional).
11
+ # :max_size - The Integer maximum size an upload can have in bytes (optional).
8
12
  def transloadit(template, options = {})
9
13
  params = Transloadit::Rails::Engine.template(template, options).to_json
10
14
  fields = hidden_field_tag(:params, params, :id => nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transloadit-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Touset
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-15 00:00:00.000000000 Z
12
+ date: 2016-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: transloadit