filestack-rails 4.0.3 → 4.0.4

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: c5cc5ab70bfa1d590ad85b287bcd8c60d392bff4
4
- data.tar.gz: ea5227a02bcca77d5a304269052b98ac1e8a6b49
3
+ metadata.gz: 10d1dda21215faca411b6cc61d5d367279174a05
4
+ data.tar.gz: 977a30972e6bde9364b8368ffc0318215400e483
5
5
  SHA512:
6
- metadata.gz: def2a1399652742a553130d4158c84e17054964edafa8c551120e9758361fb35ed5911451494018203e8ad12cc2e74a3d6c99a00a421925a834d3f7584f2fa66
7
- data.tar.gz: 5acd1b4fcf019b2027ff3c2af5b904e41f6ff3beb572d58ba7750141d3de34479f989a00f9b638625591a3ff04f0ad0be3d9bf08832d69bcf151979083eb45d1
6
+ metadata.gz: 9d3946f531f957521478f5613a5c5a0e5a48b7b611e26dc1b3f2128e6ff983f0c43d829957f8737281fad8d0d529edf0f392792069f86de06e01705ae18cef61
7
+ data.tar.gz: 0ae8c8d88a06a860a0db5b602f0829261b7b6b9b588d104ffaafe752a6e583aad84c47b3005e41af21df156fbc606570f2de58b19dca6e2937471f8fbefe4cfa
data/README.md CHANGED
@@ -213,4 +213,4 @@ Filestack::Rails follows the [Semantic Versioning](http://semver.org/).
213
213
 
214
214
  ## Issues
215
215
 
216
- If you have problems, please create a [Github Issue](https://github.com/filepicker/filestack-rails/issues).
216
+ If you have problems, please create a [Github Issue](https://github.com/filestack/filestack-rails/issues).
@@ -1,3 +1,4 @@
1
+ require 'json'
1
2
  include FilestackRails::Transform
2
3
  include FilestackRails::Version
3
4
 
@@ -48,20 +49,29 @@ module FilestackRails
48
49
  end
49
50
 
50
51
  def create_javascript_for_picker(callback, options)
51
- client_name, = get_client_and_api_key
52
+ client_name, _api_key = get_client_and_api_key
52
53
  json_string = if options.nil?
53
54
  ''
54
55
  else
55
56
  options.to_json
56
57
  end
57
- v2 = -> { "(function(){
58
- #{client_name}.pick(#{json_string}).then(function(data){#{callback}(data)})
59
- })()" }
58
+ v2 = -> do
59
+ <<~HTML
60
+ (function(){
61
+ #{client_name}.pick(#{json_string}).then(function(data){#{callback}(data)})
62
+ })()
63
+ HTML
64
+ end
65
+
66
+ v3 = -> do
67
+ json_string = json_string[1..-2] # removed curly brackets help to generate pickerOptions in js
60
68
 
61
- v3 = -> { json_string = "#{json_string}".slice!(1, json_string.length-2) # removed curly brackets help to generate pickerOptions in js
62
- "(function(){
63
- #{client_name}.picker({#{json_string}, onUploadDone: data => #{callback}(data)}).open()
64
- })()" }
69
+ <<~HTML
70
+ (function(){
71
+ #{client_name}.picker({ onUploadDone: data => #{callback}(data), #{json_string} }).open()
72
+ })()
73
+ HTML
74
+ end
65
75
  get_filestack_js_result(v2: v2, v3: v3)
66
76
  end
67
77
 
@@ -84,8 +94,15 @@ module FilestackRails
84
94
 
85
95
  def get_policy_and_signature_string
86
96
  signature, policy = get_policy_and_signature
87
- return "{'signature': '#{signature}', 'policy': '#{policy}'}" if policy && signature
88
- return "''"
97
+
98
+ if policy && signature
99
+ signature_and_policy = { signature: signature, policy: policy }
100
+ v2 = -> { signature_and_policy.to_json }
101
+ v3 = -> { { security: signature_and_policy }.to_json }
102
+ get_filestack_js_result(v2: v2, v3: v3)
103
+ else
104
+ "''"
105
+ end
89
106
  end
90
107
  end
91
108
  end
@@ -14,7 +14,7 @@ class FilestackVersion
14
14
  end
15
15
 
16
16
  module FilestackRails
17
- VERSION = '4.0.3'
17
+ VERSION = '4.0.4'
18
18
 
19
19
  module Version
20
20
  def get_filestack_js_result(results)
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: 4.0.3
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - filestack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-25 00:00:00.000000000 Z
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails