app/models/apidae/apidae_data_parser.rb in apidae-1.4.4 vs app/models/apidae/apidae_data_parser.rb in apidae-1.4.5
- old
+ new
@@ -10,10 +10,11 @@
YELP = 4007
TRIP_ADVISOR = 4000
FAX = 202
MOBILE_WEBSITE = 3769
SHORTY_URL = 4923
+ INSTAGRAM = 7221
CONTACTS_MAP = {
'telephone' => PHONE,
'email' => EMAIL,
'website' => WEBSITE,
@@ -22,11 +23,12 @@
'trip_advisor' => TRIP_ADVISOR,
'twitter' => TWITTER,
'yelp' => YELP,
'fax' => FAX,
'mobile_website' => MOBILE_WEBSITE,
- 'shorty_url' => SHORTY_URL
+ 'shorty_url' => SHORTY_URL,
+ 'instagram' => INSTAGRAM
}
MODE_AUTO = 'auto'
MODE_MANUAL = 'manual'
@@ -175,41 +177,17 @@
contact_entries.each do |c|
case c[:type][:id]
when PHONE, ALT_PHONE
contact_details[:telephone] ||= {}
contact_details[:telephone][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when EMAIL
- contact_details[:email] ||= {}
- contact_details[:email][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when WEBSITE
- contact_details[:website] ||= {}
- contact_details[:website][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when GOOGLE
- contact_details[:google] ||= {}
- contact_details[:google][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when FACEBOOK
- contact_details[:facebook] ||= {}
- contact_details[:facebook][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when TWITTER
- contact_details[:twitter] ||= {}
- contact_details[:twitter][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when YELP
- contact_details[:yelp] ||= {}
- contact_details[:yelp][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when TRIP_ADVISOR
- contact_details[:trip_advisor] ||= {}
- contact_details[:trip_advisor][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when FAX
- contact_details[:fax] ||= {}
- contact_details[:fax][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when MOBILE_WEBSITE
- contact_details[:mobile_website] ||= {}
- contact_details[:mobile_website][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
- when SHORTY_URL
- contact_details[:shorty_url] ||= {}
- contact_details[:shorty_url][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
else
+ contacts_refs_by_code = CONTACTS_MAP.invert
+ if contacts_refs_by_code.keys.include?(c[:type][:id])
+ contact_ref = contacts_refs_by_code[c[:type][:id]].to_sym
+ contact_details[contact_ref] ||= {}
+ contact_details[contact_ref][c[:identifiant]] = {value: c[:coordonnees][:fr], description: c.dig(:observation, :libelleFr)}
+ end
end
end
end
contact_details
end
@@ -280,10 +258,10 @@
apidae_obj.apidae_subtype = lists_ids(data_hash[:typesHebergement]).first if apidae_obj.apidae_type == Obj::SPA
{
categories: lists_ids(data_hash[:categories], data_hash[:typesDetailles], data_hash[:activiteCategories], data_hash[:typesHabitation]),
themes: lists_ids(data_hash[:themes]),
capacity: (data_hash[:capacite] || {})
- .merge(presta_hash ? {group_min: presta_hash[:tailleGroupeMin], group_max: presta_hash[:tailleGroupeMax],
+ .merge(presta_hash ? {group_min: (presta_hash[:nombrePersonnesMinimum] || presta_hash[:tailleGroupeMin]), group_max: presta_hash[:tailleGroupeMax],
age_min: presta_hash[:ageMin], age_max: presta_hash[:ageMax],
wheelchair_max: presta_hash[:nombrePersonnesEnFauteuilRoulantAccueilliesSimultanement]} : {}),
classification: nodes_ids(data_hash[:classement], data_hash[:classementPrefectoral], data_hash[:classification]) +
lists_ids(data_hash[:classementsGuides]) + lists_ids(data_hash[:classements]),
classification_date: data_hash[:dateClassement],
\ No newline at end of file