ika 1.0.10 → 1.0.11
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 +4 -4
- data/lib/ika/version.rb +1 -1
- data/lib/ika.rb +10 -7
- 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: b34bad1546023a0d1f4e1bdd9af0ae68473bbf36
|
4
|
+
data.tar.gz: 2de9d79ec32e2ea76245d2084cd59434a2248890
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f023cacba74e3c8a8e606c1c6e5984678c13fcef1df440c3e6f0accaa69a62ea0830a44383904993545ba6c806079091dcfee54aa9d58d7aa9c10e92fc790b36
|
7
|
+
data.tar.gz: 0d59771a41c0250942857b65bc298b26f4c95747c8288d663ce391b03e7bda6eaa0e484d185e36ad709452ec9c8f5e5a0588c9822a0e098229eee7ee7cf5dc3c
|
data/lib/ika/version.rb
CHANGED
data/lib/ika.rb
CHANGED
@@ -17,6 +17,7 @@ module Ika
|
|
17
17
|
objects = JSON.parse(json_or_array)
|
18
18
|
objects = [objects] unless objects.is_a?(Array)
|
19
19
|
end
|
20
|
+
json_or_array = nil
|
20
21
|
|
21
22
|
ActiveRecord::Base.transaction do
|
22
23
|
if options && options[:sync]
|
@@ -55,6 +56,7 @@ module Ika
|
|
55
56
|
object_params[key] = object[key]
|
56
57
|
end
|
57
58
|
end
|
59
|
+
object.delete(key) if key != 'id'
|
58
60
|
end
|
59
61
|
if record_exists
|
60
62
|
exist_object.attributes = object_params
|
@@ -63,6 +65,7 @@ module Ika
|
|
63
65
|
new(object_params).save!(validate: false)
|
64
66
|
end
|
65
67
|
remove_target_ids -= [object['id'].to_i]
|
68
|
+
object.delete('id')
|
66
69
|
end
|
67
70
|
where(id: remove_target_ids).destroy_all
|
68
71
|
end
|
@@ -72,12 +75,12 @@ module Ika
|
|
72
75
|
ika_import(json_or_array, options)
|
73
76
|
end
|
74
77
|
|
75
|
-
def ika_export(options = {},
|
78
|
+
def ika_export(options = {}, objects = nil)
|
76
79
|
CarrierWave::Uploader::Base.json_with_raw_data = true
|
77
80
|
all_symbol = true
|
78
81
|
options[:include] ||= []
|
79
82
|
options[:include] = [options[:include]] unless options[:include].is_a?(Array)
|
80
|
-
objects
|
83
|
+
objects ||= self.includes(options[:include])
|
81
84
|
options[:include].each do |opt|
|
82
85
|
all_symbol = false unless opt.is_a?(Symbol)
|
83
86
|
end
|
@@ -106,12 +109,12 @@ module Ika
|
|
106
109
|
JSON.generate(whole_obj_arr)
|
107
110
|
end
|
108
111
|
|
109
|
-
def export(options = {},
|
110
|
-
ika_export(options,
|
112
|
+
def export(options = {}, objects = nil)
|
113
|
+
ika_export(options, objects)
|
111
114
|
end
|
112
115
|
end
|
113
116
|
|
114
|
-
def ika_export(options = {},
|
117
|
+
def ika_export(options = {}, objects = nil)
|
115
118
|
CarrierWave::Uploader::Base.json_with_raw_data = true
|
116
119
|
objects ||= self
|
117
120
|
all_symbol = true
|
@@ -141,8 +144,8 @@ module Ika
|
|
141
144
|
JSON.generate(obj_hash)
|
142
145
|
end
|
143
146
|
|
144
|
-
def export(options = {},
|
145
|
-
ika_export(options,
|
147
|
+
def export(options = {}, objects = nil)
|
148
|
+
ika_export(options, objects)
|
146
149
|
end
|
147
150
|
end
|
148
151
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ika
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makoto NAKAYA
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|