apidae 0.9.17 → 0.9.18
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/app/controllers/apidae/objects_controller.rb +2 -2
- data/app/models/apidae/obj.rb +2 -0
- data/app/models/apidae/selection.rb +3 -1
- data/lib/apidae/version.rb +1 -1
- 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: 28d400967d3ea2d666c49734380cf467deb0d82b
|
4
|
+
data.tar.gz: a4c6af5d5c21d6a8b25c5504dc4e2c9007830f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e81cd23076a646eea49001e3bf1fb046177f1da56683df3334d6394d6afd5be3a71889455f61ce345d37840c198b343293dc5d85c0f720d5c85a499e7f56923
|
7
|
+
data.tar.gz: e51e78678a7bf2e176237b0854b433a1c3985f683920babea67b773c8ce070b47d59b936bed2de71b36c177df5a6e0503b67cb2512786aafe24248eee172c8b0
|
@@ -28,7 +28,7 @@ module Apidae
|
|
28
28
|
def create
|
29
29
|
@obj = Obj.new(object_params)
|
30
30
|
selection = params[:selection_apidae_id].blank? ? Selection.last : Selection.find_by_apidae_id(params[:selection_apidae_id])
|
31
|
-
if @obj.save && selection.
|
31
|
+
if @obj.save && selection.add_or_refresh_obj(@obj.apidae_id)
|
32
32
|
redirect_to objects_url, notice: "L'objet a bien été importé"
|
33
33
|
else
|
34
34
|
flash[:alert] = "Une erreur s'est produite lors de l'import de l'objet."
|
@@ -51,7 +51,7 @@ module Apidae
|
|
51
51
|
|
52
52
|
def refresh
|
53
53
|
referrer = (session.delete(:referrer) || objects_url)
|
54
|
-
if @obj && @obj.selections.first.
|
54
|
+
if @obj && @obj.selections.first.add_or_refresh_obj(@obj.apidae_id)
|
55
55
|
redirect_to referrer, notice: "L'objet touristique a bien été mis à jour."
|
56
56
|
else
|
57
57
|
redirect_to referrer, alert: "Une erreur s'est produite lors de la mise à jour de l'objet."
|
data/app/models/apidae/obj.rb
CHANGED
@@ -115,6 +115,7 @@ module Apidae
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def self.update_object(apidae_obj, object_data, locales, versions)
|
118
|
+
result = true
|
118
119
|
populate_fields(apidae_obj, object_data, locales)
|
119
120
|
apidae_obj.save!
|
120
121
|
|
@@ -130,6 +131,7 @@ module Apidae
|
|
130
131
|
end
|
131
132
|
end
|
132
133
|
end
|
134
|
+
result
|
133
135
|
|
134
136
|
# if Rails.application.config.respond_to?(:apidae_aspect) && !object_data[:aspects].blank?
|
135
137
|
# apidae_aspect = object_data[:aspects].find {|a| a[:aspect] == Rails.application.config.apidae_aspect}
|
@@ -88,7 +88,7 @@ module Apidae
|
|
88
88
|
query_objects_api(query_args, true)
|
89
89
|
end
|
90
90
|
|
91
|
-
def
|
91
|
+
def add_or_refresh_obj(apidae_obj_id)
|
92
92
|
if apidae_project
|
93
93
|
res = api_object(apidae_obj_id)
|
94
94
|
if res[:results] && res[:results].length == 1
|
@@ -100,6 +100,8 @@ module Apidae
|
|
100
100
|
Rails.application.config.apidae_obj_refresh_callback.call(apidae_obj_id)
|
101
101
|
end
|
102
102
|
refreshed
|
103
|
+
else
|
104
|
+
Obj.add_object(obj_data, apidae_project.locales, apidae_project.versions)
|
103
105
|
end
|
104
106
|
end
|
105
107
|
end
|
data/lib/apidae/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apidae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Baptiste Vilain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|