apidae 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '07291fb2c40fdbc091aff918c45c201602a5d58c'
4
- data.tar.gz: 76f4566eb71404f129add27100872f1263ae868b
3
+ metadata.gz: 825f592628dd0818de54c1fce82fa36b7b97140b
4
+ data.tar.gz: f857a1e30e89a720ab025d2171915e203638fa36
5
5
  SHA512:
6
- metadata.gz: fa72db3de71d37e56b2c8908d703419a72fc5f0efd2d9f03ce91233ae0d68bd402f4a49d775fa22856a2109f83c7bb8bb54593224cc1e14377f696afc2e6d811
7
- data.tar.gz: e1a0c2c71710947ea1b47266e2bb995ba5a44cec98190b3358168e21681ce9b2da4d3c479932514620929da4758affe03cece6e8693cf2f4458e327af108f7a8
6
+ metadata.gz: c242aa6b115d15716e01db251b30ccb8d76dcdd1a1c118691a090ed3a151742d3ea02d43d39f1bef71855a300e3ee0f736d2fa3bd4cc9aa1d77da9cf7511b13b
7
+ data.tar.gz: e34650ebe27509274682fa4e968f7d12d1f3f3577cdc5183e0c464595dc65c86ace66f323b21a774a4045a177ac4ac3ca21d225ae6a85bb9941641f442a1a0da
@@ -1,8 +1,14 @@
1
1
  module Apidae
2
2
  class ApidaeDataParser
3
3
  PHONE = 201
4
+ ALT_PHONE = 206
4
5
  EMAIL = 204
5
6
  WEBSITE = 205
7
+ GOOGLE = 3789
8
+ FACEBOOK = 207
9
+ TWITTER = 3755
10
+ YELP = 4007
11
+ TRIP_ADVISOR = 4000
6
12
 
7
13
  MODE_AUTO = 'auto'
8
14
  MODE_MANUAL = 'manual'
@@ -142,7 +148,7 @@ module Apidae
142
148
  contact_entries = information_hash[:moyensCommunication] || []
143
149
  contact_entries.each do |c|
144
150
  case c[:type][:id]
145
- when PHONE
151
+ when PHONE, ALT_PHONE
146
152
  contact_details[:telephone] ||= []
147
153
  contact_details[:telephone] << c[:coordonnees][:fr]
148
154
  when EMAIL
@@ -151,6 +157,21 @@ module Apidae
151
157
  when WEBSITE
152
158
  contact_details[:website] ||= []
153
159
  contact_details[:website] << c[:coordonnees][:fr]
160
+ when GOOGLE
161
+ contact_details[:google] ||= []
162
+ contact_details[:google] << c[:coordonnees][:fr]
163
+ when FACEBOOK
164
+ contact_details[:facebook] ||= []
165
+ contact_details[:facebook] << c[:coordonnees][:fr]
166
+ when TWITTER
167
+ contact_details[:twitter] ||= []
168
+ contact_details[:twitter] << c[:coordonnees][:fr]
169
+ when YELP
170
+ contact_details[:yelp] ||= []
171
+ contact_details[:yelp] << c[:coordonnees][:fr]
172
+ when TRIP_ADVISOR
173
+ contact_details[:trip_advisor] ||= []
174
+ contact_details[:trip_advisor] << c[:coordonnees][:fr]
154
175
  else
155
176
  end
156
177
  end
@@ -229,7 +250,8 @@ module Apidae
229
250
  track: apidae_obj.apidae_type == Obj::EQU ? data_hash[:itineraire] : nil,
230
251
  products: lists_ids(data_hash[:typesProduit], data_hash[:aopAocIgps], data_hash[:specialites]),
231
252
  audience: lists_ids(prestations_hash[:typesClientele]),
232
- animals: prestations_hash[:animauxAcceptes] == 'ACCEPTES',
253
+ animals: {allowed: prestations_hash[:animauxAcceptes] == 'ACCEPTES', desc: node_value(prestations_hash, :descriptifAnimauxAcceptes, *locales),
254
+ fee: prestations_hash[:animauxAcceptesSupplement] == 'AVEC_SUPPLEMENT'},
233
255
  extra: apidae_obj.apidae_type == Obj::SPA ? node_value(data_hash, :formuleHebergement, *locales) : node_value(prestations_hash, :complementAccueil, *locales),
234
256
  duration: apidae_obj.apidae_type == Obj::SPA ? {days: data_hash[:nombreJours], nights: data_hash[:nombreNuits]} : data_hash[:dureeSeance],
235
257
  certifications: data_hash[:agrements].blank? ? [] : data_hash[:agrements].map {|a| {id: a[:type][:id], identifier: a[:numero]}},
@@ -14,9 +14,9 @@ module Apidae
14
14
  store_accessor :pictures_data, :pictures
15
15
  store_accessor :attachments_data, :attachments
16
16
  store_accessor :type_data, :categories, :themes, :capacity, :classification, :labels, :chains, :area, :track,
17
- :products, :audience, :animals, :extra, :duration, :certifications, :business
17
+ :products, :audience, :animals, :animals_desc, :extra, :duration, :certifications, :business
18
18
  store_accessor :entity_data, :entity_id, :entity_name, :service_provider_id
19
- store_accessor :contact_data, :telephone, :email, :website, :contacts
19
+ store_accessor :contact_data, :telephone, :email, :website, :google, :facebook, :twitter, :yelp, :trip_advisor, :contacts
20
20
  store_accessor :location_data, :address, :place, :latitude, :longitude, :access, :territories, :environments
21
21
  store_accessor :openings_data, :openings_desc, :openings_desc_mode, :openings, :time_periods
22
22
  store_accessor :rates_data, :rates_desc, :rates_desc_mode, :rates, :payment_methods, :includes, :excludes
@@ -122,6 +122,18 @@ module Apidae
122
122
  self
123
123
  end
124
124
 
125
+ def dig(*keys)
126
+ root_key, *nested_keys = keys
127
+ root_val = self.send(root_key)
128
+ if root_val.blank?
129
+ nested_keys.blank? ? root_val : nil
130
+ elsif root_val.respond_to?(:dig)
131
+ root_val.dig(*nested_keys)
132
+ else
133
+ raise ArgumentError.new('Cannot call dig with these args')
134
+ end
135
+ end
136
+
125
137
  def self.default_scope
126
138
  where(root_obj_id: nil)
127
139
  end
@@ -39,4 +39,21 @@ fr:
39
39
  HANDICAP: Handicap
40
40
  TOURISME_AFFAIRES: Affaires
41
41
  GROUPES: Groupes
42
- PRESTATAIRE_ACTIVITES: Prestataire d'activités
42
+ PRESTATAIRE_ACTIVITES: Prestataire d'activités
43
+ types:
44
+ ACTIVITE: Activités
45
+ COMMERCE_ET_SERVICE: Commerces et services
46
+ DEGUSTATION: Producteurs
47
+ DOMAINE_SKIABLE: Domaines skiables
48
+ EQUIPEMENT: Équipements
49
+ FETE_ET_MANIFESTATION: Fêtes et manifestations
50
+ HEBERGEMENT_COLLECTIF: Hébergements collectifs
51
+ HEBERGEMENT_LOCATIF: Hébergements locatifs
52
+ HOTELLERIE: Hôtellerie
53
+ HOTELLERIE_PLEIN_AIR: Hôtellerie de plein air
54
+ PATRIMOINE_CULTUREL: Patrimoine culturel
55
+ PATRIMOINE_NATUREL: Patrimoine naturel
56
+ RESTAURATION: Restauration
57
+ SEJOUR_PACKAGE: Séjour et produits packagés
58
+ STRUCTURE: Entité juridique
59
+ TERRITOIRE: Territoire
@@ -1,3 +1,3 @@
1
1
  module Apidae
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
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: 1.0.0
4
+ version: 1.0.2
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: 2020-05-22 00:00:00.000000000 Z
11
+ date: 2020-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '2.5'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '2.5'
69
69
  description: To be completed
70
70
  email:
71
71
  - jbvilain@gmail.com