apidae 0.10.0 → 0.11.0
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/models/apidae/obj.rb +22 -14
- data/config/initializers/constants.rb +2 -0
- data/db/migrate/20190127210921_migrate_localized_apidae_obj_fields.rb +1 -0
- data/lib/apidae/version.rb +1 -1
- data/test/data/equ_groups.json +16 -4
- data/test/dummy/log/test.log +1534 -0
- data/test/models/apidae/file_import_test.rb +13 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 765dd17ae6901f726e634a675934148a79715022
|
4
|
+
data.tar.gz: bab182d1cc1367ed70b10dfda1bb1d3a08f0d47c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a019141cef8e85dc8806cd73c31dfbc02e5f95758c9be26825a7c8b647a4cb99ff2fd41af12723f8c867e9b52095d583ee195011dd5d8d2cf2de2c6d1775f5d1
|
7
|
+
data.tar.gz: 6695e5409d28e870ee3096db3737e88f3db3cc701ec5362860b8eab60c65ba45678ff20e6dbc780a9dc6db1c478a2c58baaf24d2a3eb1c6eff088738c52dde77
|
data/app/models/apidae/obj.rb
CHANGED
@@ -25,30 +25,38 @@ module Apidae
|
|
25
25
|
store_accessor :tags_data, :promo, :internal, :linked
|
26
26
|
store_accessor :version_data, :versioned_fields
|
27
27
|
|
28
|
-
|
29
|
-
alias_method :"#{f}
|
30
|
-
alias_method :"#{f}
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
ALL_FIELDS.each do |f|
|
29
|
+
alias_method :"get_#{f}", :"#{f}"
|
30
|
+
alias_method :"set_#{f}", :"#{f}="
|
31
|
+
|
32
|
+
if LOCALIZED_FIELDS.include?(f)
|
33
|
+
define_method "#{f}=" do |val|
|
34
|
+
ref_obj = (@obj_version == DEFAULT_VERSION || @obj_version.nil?) ? self : in_version(@obj_version)
|
35
|
+
current_val = ref_obj.send(:"get_#{f}") || {}
|
36
|
+
ref_obj.send(:"set_#{f}", current_val.merge(@locale => val))
|
37
|
+
end
|
38
|
+
else
|
39
|
+
define_method "#{f}=" do |val|
|
40
|
+
ref_obj = (@obj_version == DEFAULT_VERSION || @obj_version.nil?) ? self : in_version(@obj_version)
|
41
|
+
ref_obj.send(:"set_#{f}", val)
|
42
|
+
end
|
36
43
|
end
|
37
44
|
|
38
45
|
define_method f do
|
39
|
-
|
46
|
+
default_value = LOCALIZED_FIELDS.include?(f) ? {} : nil
|
47
|
+
field_val = self.send(:"get_#{f}") || default_value
|
40
48
|
unless @obj_version == DEFAULT_VERSION
|
41
49
|
versioned_obj = in_version(@obj_version)
|
42
50
|
if versioned_obj
|
43
|
-
|
51
|
+
versioned_value = versioned_obj.send(:"get_#{f}") || default_value
|
44
52
|
if versioned_obj.versioned_fields.include?(f.to_s)
|
45
|
-
|
46
|
-
|
47
|
-
|
53
|
+
field_val = versioned_value
|
54
|
+
elsif field_val.respond_to?('deep_merge!')
|
55
|
+
field_val.deep_merge!(versioned_value)
|
48
56
|
end
|
49
57
|
end
|
50
58
|
end
|
51
|
-
|
59
|
+
LOCALIZED_FIELDS.include?(f) ? (field_val[@locale] || field_val[DEFAULT_LOCALE]) : field_val
|
52
60
|
end
|
53
61
|
end
|
54
62
|
|
@@ -26,4 +26,6 @@ module Apidae
|
|
26
26
|
|
27
27
|
LOCALIZED_FIELDS = [:title, :short_desc, :long_desc, :pictures, :attachments, :openings_desc, :rates_desc,
|
28
28
|
:includes, :excludes, :extra, :booking_desc]
|
29
|
+
ALL_FIELDS = LOCALIZED_FIELDS + [:theme_desc, :private_desc, :capacity, :telephone, :email, :website, :services,
|
30
|
+
:equipments, :comfort, :activities, :promo, :internal, :linked]
|
29
31
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class MigrateLocalizedApidaeObjFields < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
|
+
# Todo
|
3
4
|
Apidae::Obj.all.each do |o|
|
4
5
|
o.short_desc_hash = {'fr' => o.description_data['short_desc']} unless (o.description_data.blank? || !o.description_data.has_key?('short_desc') || o.description_data['short_desc'].is_a?(Hash))
|
5
6
|
o.long_desc_hash = {'fr' => o.description_data['long_desc']} unless (o.description_data.blank? || !o.description_data.has_key?('long_desc') || o.description_data['long_desc'].is_a?(Hash))
|
data/lib/apidae/version.rb
CHANGED
data/test/data/equ_groups.json
CHANGED
@@ -550,7 +550,7 @@
|
|
550
550
|
"ordre" : 170
|
551
551
|
}
|
552
552
|
} ],
|
553
|
-
"tailleGroupeMax" :
|
553
|
+
"tailleGroupeMax" : 64
|
554
554
|
},
|
555
555
|
"ouverture" : {
|
556
556
|
"periodeEnClair" : {
|
@@ -1242,7 +1242,7 @@
|
|
1242
1242
|
},
|
1243
1243
|
"aspects" : [ {
|
1244
1244
|
"aspect" : "GROUPES",
|
1245
|
-
"champsAspect" : [ "illustrations", "descriptionTarif.indicationTarif", "descriptionTarif.periodes", "descriptionTarif.tarifsEnClairAutomatique", "ouverture.periodeEnClair", "descriptionTarif.conditions.gratuitPourLesMoinsDe", "descriptionTarif.complement", "multimedias", "presentation.descriptifDetaille", "informations.moyensCommunication", "descriptionTarif.tarifsEnClair", "prestations.tailleGroupeMax", "ouverture.periodeEnClairAutomatique", "presentation.descriptifCourt", "reservation.complement", "ouverture.periodesOuvertures" ],
|
1245
|
+
"champsAspect" : [ "illustrations", "descriptionTarif.indicationTarif", "descriptionTarif.periodes", "descriptionTarif.tarifsEnClairAutomatique", "ouverture.periodeEnClair", "descriptionTarif.conditions.gratuitPourLesMoinsDe", "descriptionTarif.complement", "multimedias", "presentation.descriptifDetaille", "informations.moyensCommunication", "descriptionTarif.tarifsEnClair", "prestations.tailleGroupeMax", "prestations.equipements", "ouverture.periodeEnClairAutomatique", "presentation.descriptifCourt", "reservation.complement", "ouverture.periodesOuvertures" ],
|
1246
1246
|
"informations" : {
|
1247
1247
|
"moyensCommunication" : [ {
|
1248
1248
|
"identifiant" : 72276483,
|
@@ -1288,8 +1288,20 @@
|
|
1288
1288
|
}
|
1289
1289
|
},
|
1290
1290
|
"prestations" : {
|
1291
|
-
"tailleGroupeMax" : 72
|
1292
|
-
|
1291
|
+
"tailleGroupeMax" : 72,
|
1292
|
+
"equipements" : [ {
|
1293
|
+
"elementReferenceType" : "PrestationEquipement",
|
1294
|
+
"id" : 613,
|
1295
|
+
"libelleFr" : "Aire de pique-nique",
|
1296
|
+
"ordre" : 30,
|
1297
|
+
"familleCritere" : {
|
1298
|
+
"elementReferenceType" : "FamilleCritere",
|
1299
|
+
"id" : 122,
|
1300
|
+
"libelleFr" : "Equipements de loisirs",
|
1301
|
+
"ordre" : 51
|
1302
|
+
}
|
1303
|
+
}
|
1304
|
+
] },
|
1293
1305
|
"ouverture" : {
|
1294
1306
|
"periodeEnClair" : {
|
1295
1307
|
"libelleFr" : "Du 01/05 au 31/10.\nÀ partir de 10h30, uniquement sur réservation.\n\nSous réserve de conditions météo favorables."
|