apollo_upload_server 2.0.0.alpha.3 → 2.0.0.alpha.4
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10005a86d023dffcbe955f801d693d3ba62b7ab1
|
|
4
|
+
data.tar.gz: e60aea89cf3a64e889f694e1ac1ddf60fef1d926
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a15c667570265b4945dae967168b975eba54f32037cfaa608ca1b3b78493f380ddbbecd7b500662016f3a488c7cdb961e5767cf032ce46117ab354652547895
|
|
7
|
+
data.tar.gz: 102231ab9e60219d655d6b990542a01cdba6d2990b166615bfe9b8428a124ff51ab0340adc26831f47d7748c597d0dabad6b17ad421348295817feee997e8751
|
|
@@ -21,9 +21,10 @@ module ApolloUploadServer
|
|
|
21
21
|
file_mapper.each do |file_index, paths|
|
|
22
22
|
paths.each do |path|
|
|
23
23
|
splited_path = path.split('.')
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
# splited_path => 'variables.input.profile_photo'; splited_path[0..-2] => ['variables', 'input']
|
|
25
|
+
# dig from first to penultimate key, and merge last key with value as file
|
|
26
|
+
field = operations.dig(*splited_path[0..-2])
|
|
27
|
+
assign_file(field, splited_path, params[file_index])
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
operations
|
|
@@ -34,8 +35,9 @@ module ApolloUploadServer
|
|
|
34
35
|
file_mapper.each do |file_index, paths|
|
|
35
36
|
paths.each do |path|
|
|
36
37
|
splited_path = path.split('.')
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
# dig from second to penultimate key, and merge last key with value as file to operation with first key index
|
|
39
|
+
field = operations[splited_path.first.to_i].dig(*splited_path[1..-2])
|
|
40
|
+
assign_file(field, splited_path, params[file_index])
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
operations
|
|
@@ -46,5 +48,13 @@ module ApolloUploadServer
|
|
|
46
48
|
rescue JSON::ParserError
|
|
47
49
|
nil
|
|
48
50
|
end
|
|
51
|
+
|
|
52
|
+
def assign_file(field, splited_path, file)
|
|
53
|
+
if field.is_a? Hash
|
|
54
|
+
field.merge!(splited_path.last => file)
|
|
55
|
+
elsif field.is_a? Array
|
|
56
|
+
field[splited_path.last.to_i] = file
|
|
57
|
+
end
|
|
58
|
+
end
|
|
49
59
|
end
|
|
50
60
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apollo_upload_server
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.0.alpha.
|
|
4
|
+
version: 2.0.0.alpha.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- JetRuby
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-02
|
|
11
|
+
date: 2018-03-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|