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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -1
- data/CHANGELOG.md +4 -0
- data/LICENSE +1 -1
- data/lib/transloadit/rails/engine.rb +19 -6
- data/lib/transloadit/rails/version.rb +1 -1
- data/lib/transloadit/rails/view_helper.rb +4 -0
- 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: 9e46058e6c8e5bcfe204b3b88c65dbf785b1d3fe
|
4
|
+
data.tar.gz: f55864e9016db5bb63c66629364fe05e52838002
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4085ab14244992ac22ab3145bf4efbdbb9df4ffa475215cc1734d7c7c4a5b82407765b615c311aca15756c1787d04b380adc9d2fb0438273352ac8ebbe9cb16
|
7
|
+
data.tar.gz: 1ffcf1c1976bf9d9db1ed6d33aa6abc855ecae065cda4e1eb04bdbe3a1329bdad5f2ee5bfa10d4c2c98f38476a81405f28c604835193df136b75fbe0ac741efb
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
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
|
-
|
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
|
-
|
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
|
#
|
@@ -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.
|
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:
|
12
|
+
date: 2016-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: transloadit
|