apidae 1.4.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/apidae/apidae_data_parser.rb +12 -6
- data/app/models/apidae/obj.rb +6 -5
- data/config/initializers/constants.rb +3 -3
- data/lib/apidae/version.rb +1 -1
- data/test/dummy/log/test.log +556 -0
- data/test/models/apidae/obj_test.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aabfe9be4d2de7c87baa00f3234faf20fe31ab8125f6163acf65e0aa772e1dbc
|
4
|
+
data.tar.gz: fb0e940576b5b979ed5ae0dd5fba63c24578c8293152372e8f0dfa67d195588b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc81a47d8e6165241e0449217e116e1d9f22e39c4e403ba377950bc8d527631abe593ab2be49ef589d1f8dbca41430606c890722020bb525a364dcaa3642f9a3
|
7
|
+
data.tar.gz: fbd8e4c42aec95838f8a65c6d88a73f07f82082910d42fbbf71068678adb51cccc1d6caf61e9e1bded5424d965ade31c46ec49bbe6eb1d649fc0227bd12fe06f
|
@@ -112,13 +112,14 @@ module Apidae
|
|
112
112
|
owner_data
|
113
113
|
end
|
114
114
|
|
115
|
-
def self.parse_desc_data(data_hash, private_data, *locales)
|
115
|
+
def self.parse_desc_data(data_hash, private_data, presta_data, *locales)
|
116
116
|
unless data_hash.blank?
|
117
117
|
{
|
118
118
|
short_desc: node_value(data_hash, :descriptifCourt, *locales),
|
119
119
|
long_desc: node_value(data_hash, :descriptifDetaille, *locales),
|
120
120
|
theme_desc: data_hash[:descriptifsThematises].blank? ? {} : Hash[data_hash[:descriptifsThematises].map {|th| [node_id(th, :theme), node_value(th, :description, *locales)]}],
|
121
|
-
private_desc: private_data.blank? ? {} : Hash[private_data.map {|d| [d[:nomTechnique], (node_value(d, :descriptif, *locales).blank? ? {LOCALE_FR => d[:libelleFr]} : node_value(d, :descriptif, *locales))]}]
|
121
|
+
private_desc: private_data.blank? ? {} : Hash[private_data.map {|d| [d[:nomTechnique], (node_value(d, :descriptif, *locales).blank? ? {LOCALE_FR => d[:libelleFr]} : node_value(d, :descriptif, *locales))]}],
|
122
|
+
accessibility_desc: presta_data.blank? ? {} : Hash[presta_data.select {|k, v| k.to_s.start_with?('descriptifHandicap')}.map {|k, v| [k, node_value(presta_data, k, *locales)]}]
|
122
123
|
}
|
123
124
|
end
|
124
125
|
end
|
@@ -138,7 +139,7 @@ module Apidae
|
|
138
139
|
description: localized_value(pic, :legende, locale),
|
139
140
|
credits: localized_value(pic, :copyright, locale),
|
140
141
|
expiration_date: pic[:dateLimiteDePublication] || '',
|
141
|
-
properties: {size: pic_file[:taille], width: pic_file[:largeur], height: pic_file[:
|
142
|
+
properties: {size: pic_file[:taille], width: pic_file[:largeur], height: pic_file[:hauteur]}
|
142
143
|
}
|
143
144
|
end
|
144
145
|
end
|
@@ -282,7 +283,8 @@ module Apidae
|
|
282
283
|
themes: lists_ids(data_hash[:themes]),
|
283
284
|
capacity: (data_hash[:capacite] || {})
|
284
285
|
.merge(presta_hash ? {group_min: presta_hash[:tailleGroupeMin], group_max: presta_hash[:tailleGroupeMax],
|
285
|
-
age_min: presta_hash[:ageMin], age_max: presta_hash[:ageMax]
|
286
|
+
age_min: presta_hash[:ageMin], age_max: presta_hash[:ageMax],
|
287
|
+
wheelchair_max: presta_hash[:nombrePersonnesEnFauteuilRoulantAccueilliesSimultanement]} : {}),
|
286
288
|
classification: nodes_ids(data_hash[:classement], data_hash[:classementPrefectoral], data_hash[:classification]) +
|
287
289
|
lists_ids(data_hash[:classementsGuides]) + lists_ids(data_hash[:classements]),
|
288
290
|
classification_date: data_hash[:dateClassement],
|
@@ -317,7 +319,8 @@ module Apidae
|
|
317
319
|
type_data_hash ? type_data_hash[:activitesSportives] : [],
|
318
320
|
type_data_hash ? type_data_hash[:activitesCulturelles] : []),
|
319
321
|
challenged: lists_ids(data_hash[:tourismesAdaptes]),
|
320
|
-
languages: lists_ids(data_hash[:languesParlees])
|
322
|
+
languages: lists_ids(data_hash[:languesParlees]),
|
323
|
+
documentation_languages: lists_ids(data_hash[:languesDocumentation])
|
321
324
|
}
|
322
325
|
end
|
323
326
|
end
|
@@ -365,7 +368,10 @@ module Apidae
|
|
365
368
|
entity_hash = {}
|
366
369
|
if information_hash
|
367
370
|
if information_hash[:structureGestion]
|
368
|
-
entity_hash.merge!({entity_id: information_hash[:structureGestion][:id],
|
371
|
+
entity_hash.merge!({entity_id: information_hash[:structureGestion][:id], entity_name: information_hash[:structureGestion].dig(:nom, :libelleFr),
|
372
|
+
info_entity_id: (information_hash[:structureInformation] || information_hash[:structureGestion])[:id],
|
373
|
+
info_entity_name: (information_hash[:structureInformation] || information_hash[:structureGestion]).dig(:nom, :libelleFr),
|
374
|
+
service_provider_id: node_id(type_data_hash, :prestataireActivites)})
|
369
375
|
end
|
370
376
|
|
371
377
|
if information_hash[:informationsLegales]
|
data/app/models/apidae/obj.rb
CHANGED
@@ -8,22 +8,23 @@ module Apidae
|
|
8
8
|
attr_accessor :locale
|
9
9
|
attr_accessor :obj_version
|
10
10
|
attr_accessor :obj_versions
|
11
|
+
attr_accessor :skip_archiving
|
11
12
|
|
12
13
|
store_accessor :title_data, :title
|
13
14
|
store_accessor :owner_data, :owner_name, :owner_id, :polls
|
14
|
-
store_accessor :description_data, :short_desc, :long_desc, :theme_desc, :private_desc
|
15
|
+
store_accessor :description_data, :short_desc, :long_desc, :theme_desc, :private_desc, :accessibility_desc
|
15
16
|
store_accessor :pictures_data, :pictures
|
16
17
|
store_accessor :attachments_data, :attachments
|
17
18
|
store_accessor :type_data, :categories, :themes, :capacity, :classification, :classification_date,
|
18
19
|
:classification_ref, :labels, :chains, :area, :track, :tricky_sections, :products, :audience, :animals,
|
19
20
|
:animals_desc, :extra, :duration, :certifications, :business, :business_equipments, :business_rooms
|
20
|
-
store_accessor :entity_data, :entity_id, :entity_name, :service_provider_id, :is_service_provider, :legal
|
21
|
+
store_accessor :entity_data, :entity_id, :entity_name, :info_entity_id, :info_entity_name, :service_provider_id, :is_service_provider, :legal
|
21
22
|
store_accessor :contact_data, :telephone, :email, :website, :google, :facebook, :twitter, :yelp, :trip_advisor, :fax,
|
22
23
|
:mobile_website, :shorty_url, :contacts
|
23
24
|
store_accessor :location_data, :address, :place, :latitude, :longitude, :access, :territories, :environments, :altitude, :map_reference
|
24
25
|
store_accessor :openings_data, :openings_desc, :openings_desc_mode, :openings, :time_periods, :openings_extra, :opening_days
|
25
26
|
store_accessor :rates_data, :rates_desc, :rates_desc_mode, :rates, :payment_methods, :includes, :excludes, :rates_extra, :tax_included
|
26
|
-
store_accessor :service_data, :services, :equipments, :comfort, :activities, :challenged, :languages
|
27
|
+
store_accessor :service_data, :services, :equipments, :comfort, :activities, :challenged, :languages, :documentation_languages
|
27
28
|
store_accessor :booking_data, :booking_desc, :booking_entities, :visits_allowed, :visits_desc, :visits_duration, :visits_services
|
28
29
|
store_accessor :tags_data, :promo, :internal, :linked
|
29
30
|
store_accessor :version_data, :versioned_fields
|
@@ -152,7 +153,7 @@ module Apidae
|
|
152
153
|
self.prev_data ||= {}
|
153
154
|
ignored_root_attributes = ['prev_data', 'updated_at']
|
154
155
|
changed_attributes.each_pair do |attr, prev_value|
|
155
|
-
unless ignored_root_attributes.include?(attr)
|
156
|
+
unless ignored_root_attributes.include?(attr) || skip_archiving
|
156
157
|
if prev_value.is_a?(Hash)
|
157
158
|
archive_hash_value(prev_value)
|
158
159
|
else
|
@@ -234,7 +235,7 @@ module Apidae
|
|
234
235
|
apidae_obj.apidae_type = object_data[:type]
|
235
236
|
apidae_obj.apidae_subtype = ApidaeDataParser.node_id(object_data[type_fields[:node]], type_fields[:subtype])
|
236
237
|
apidae_obj.title_data = ApidaeDataParser.parse_title(object_data, *locales)
|
237
|
-
apidae_obj.description_data = ApidaeDataParser.parse_desc_data(object_data[:presentation], object_data[:donneesPrivees], *locales)
|
238
|
+
apidae_obj.description_data = ApidaeDataParser.parse_desc_data(object_data[:presentation], object_data[:donneesPrivees], object_data[:prestations], *locales)
|
238
239
|
apidae_obj.contact_data = ApidaeDataParser.parse_contact_data(object_data[:informations], object_data[:contacts])
|
239
240
|
apidae_obj.location_data = ApidaeDataParser.parse_location_data(object_data[:localisation], object_data[type_fields[:node]],
|
240
241
|
object_data[:territoires])
|
@@ -25,9 +25,9 @@ module Apidae
|
|
25
25
|
ALL_VERSIONS = [STANDARD_VERSION, WINTER_VERSION, SUMMER_VERSION, CHALLENGED_VERSION, BUSINESS_VERSION,
|
26
26
|
GROUPS_VERSION, ACTIVITIES_VERSION]
|
27
27
|
|
28
|
-
LOCALIZED_FIELDS = [:title, :short_desc, :long_desc, :pictures, :attachments,
|
29
|
-
:includes, :excludes, :extra, :booking_desc]
|
30
|
-
ALL_FIELDS = LOCALIZED_FIELDS + [:theme_desc, :private_desc, :capacity, :telephone, :email, :website,
|
28
|
+
LOCALIZED_FIELDS = [:title, :short_desc, :long_desc, :pictures, :attachments,
|
29
|
+
:openings_desc, :rates_desc, :includes, :excludes, :extra, :booking_desc]
|
30
|
+
ALL_FIELDS = LOCALIZED_FIELDS + [:theme_desc, :private_desc, :accessibility_desc, :capacity, :telephone, :email, :website,
|
31
31
|
:google, :facebook, :twitter, :yelp, :trip_advisor, :fax, :mobile_website, :shorty_url,
|
32
32
|
:openings, :openings_extra, :rates, :services, :payment_methods, :categories, :themes,
|
33
33
|
:labels, :chains, :classification, :challenged, :environments, :languages, :products,
|
data/lib/apidae/version.rb
CHANGED