apidae 1.2.5 → 1.2.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83dac0ec19bab501ffe685ff871e4b1ebacb8211
|
4
|
+
data.tar.gz: 2e12955db455702f7ca0224fdc63ff543c3c630b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eda22b22c6297ddd8005bb992511d55125bb579998f48e9fbc3769ed7cc78aff2976fbfcbcca6dccd50ac2005d4b8d536adab0eb9a9a931e28776b043a761f8
|
7
|
+
data.tar.gz: 750bce121a6043b2b95513095e3a08bf31411be05fc1ac06efd0636dde66aacfba9c4daf9fd7e6a4a5307764ee77ad7b1b2b4784661419403f76a88d1fcbf365
|
@@ -151,6 +151,7 @@ module Apidae
|
|
151
151
|
name: localized_value(att, :nom, locale),
|
152
152
|
url: att[:traductionFichiers][0][:url].gsub('http:', 'https:'),
|
153
153
|
type: att[:type],
|
154
|
+
link: att[:link],
|
154
155
|
description: localized_value(att, :legende, locale)
|
155
156
|
}
|
156
157
|
end
|
@@ -336,10 +337,15 @@ module Apidae
|
|
336
337
|
end
|
337
338
|
end
|
338
339
|
|
339
|
-
def self.parse_entity_fields(information_hash, type_data_hash)
|
340
|
+
def self.parse_entity_fields(information_hash, type_data_hash, sp_hash)
|
341
|
+
entity_hash = {}
|
340
342
|
if information_hash && information_hash[:structureGestion]
|
341
|
-
{entity_id: information_hash[:structureGestion][:id], service_provider_id: node_id(type_data_hash, :prestataireActivites)}
|
343
|
+
entity_hash.merge!({entity_id: information_hash[:structureGestion][:id], service_provider_id: node_id(type_data_hash, :prestataireActivites)})
|
342
344
|
end
|
345
|
+
if sp_hash && sp_hash[:prestataireActivites]
|
346
|
+
entity_hash[:is_service_provider] = true
|
347
|
+
end
|
348
|
+
entity_hash
|
343
349
|
end
|
344
350
|
|
345
351
|
def self.node_id(node, key)
|
data/app/models/apidae/obj.rb
CHANGED
@@ -7,6 +7,7 @@ module Apidae
|
|
7
7
|
|
8
8
|
attr_accessor :locale
|
9
9
|
attr_accessor :obj_version
|
10
|
+
attr_accessor :obj_versions
|
10
11
|
|
11
12
|
store_accessor :title_data, :title
|
12
13
|
store_accessor :owner_data, :owner_name, :owner_id
|
@@ -15,7 +16,7 @@ module Apidae
|
|
15
16
|
store_accessor :attachments_data, :attachments
|
16
17
|
store_accessor :type_data, :categories, :themes, :capacity, :classification, :labels, :chains, :area, :track,
|
17
18
|
:products, :audience, :animals, :animals_desc, :extra, :duration, :certifications, :business
|
18
|
-
store_accessor :entity_data, :entity_id, :entity_name, :service_provider_id
|
19
|
+
store_accessor :entity_data, :entity_id, :entity_name, :service_provider_id, :is_service_provider
|
19
20
|
store_accessor :contact_data, :telephone, :email, :website, :google, :facebook, :twitter, :yelp, :trip_advisor, :fax,
|
20
21
|
:mobile_website, :shorty_url, :contacts
|
21
22
|
store_accessor :location_data, :address, :place, :latitude, :longitude, :access, :territories, :environments
|
@@ -83,7 +84,7 @@ module Apidae
|
|
83
84
|
COS => {node: :informationsCommerceEtService, subtype: :commerceEtServiceType},
|
84
85
|
DEG => {node: :informationsDegustation, subtype: :degustationType},
|
85
86
|
DOS => {node: :informationsDomaineSkiable, subtype: :domaineSkiableType},
|
86
|
-
EQU => {node: :informationsEquipement, subtype: :
|
87
|
+
EQU => {node: :informationsEquipement, subtype: :rubrique},
|
87
88
|
FEM => {node: :informationsFeteEtManifestation, subtype: :feteEtManifestationType},
|
88
89
|
HCO => {node: :informationsHebergementCollectif, subtype: :hebergementCollectifType},
|
89
90
|
HLO => {node: :informationsHebergementLocatif, subtype: :hebergementLocatifType},
|
@@ -100,6 +101,7 @@ module Apidae
|
|
100
101
|
after_initialize do
|
101
102
|
@locale = DEFAULT_LOCALE
|
102
103
|
@obj_version = DEFAULT_VERSION
|
104
|
+
@obj_versions = {}
|
103
105
|
end
|
104
106
|
|
105
107
|
def root_obj
|
@@ -111,11 +113,15 @@ module Apidae
|
|
111
113
|
end
|
112
114
|
|
113
115
|
def in_version(v)
|
114
|
-
|
115
|
-
|
116
|
-
|
116
|
+
if v == DEFAULT_VERSION && root_obj_id.nil?
|
117
|
+
@obj_version = DEFAULT_VERSION
|
118
|
+
self
|
119
|
+
else
|
120
|
+
if @obj_versions[v].nil?
|
121
|
+
@obj_versions[v] = versions.where(version: v).first
|
122
|
+
end
|
123
|
+
@obj_versions[v]
|
117
124
|
end
|
118
|
-
@cached_versions[v]
|
119
125
|
end
|
120
126
|
|
121
127
|
def in_locale(l)
|
@@ -164,6 +170,7 @@ module Apidae
|
|
164
170
|
apidae_obj
|
165
171
|
end
|
166
172
|
|
173
|
+
# Note : overrides existing fields (not a merge)
|
167
174
|
def self.populate_fields(apidae_obj, object_data, locales)
|
168
175
|
type_fields = TYPES_DATA[object_data[:type]]
|
169
176
|
apidae_obj.last_update = DateTime.parse(object_data[:gestion][:dateModification]) unless object_data[:gestion].blank?
|
@@ -183,7 +190,7 @@ module Apidae
|
|
183
190
|
object_data[:tourismeAffaires], *locales)
|
184
191
|
apidae_obj.pictures_data = ApidaeDataParser.parse_pictures_data(object_data[:illustrations], *locales)
|
185
192
|
apidae_obj.attachments_data = ApidaeDataParser.parse_attachments_data(object_data[:multimedias], *locales)
|
186
|
-
apidae_obj.entity_data = ApidaeDataParser.parse_entity_fields(object_data[:informations], object_data[type_fields[:node]])
|
193
|
+
apidae_obj.entity_data = ApidaeDataParser.parse_entity_fields(object_data[:informations], object_data[type_fields[:node]], object_data[:informationsPrestataireActivites])
|
187
194
|
apidae_obj.service_data = ApidaeDataParser.parse_service_data(object_data[:prestations], object_data[type_fields[:node]])
|
188
195
|
apidae_obj.tags_data = ApidaeDataParser.parse_tags_data(object_data[:presentation], object_data[:criteresInternes], object_data[:liens])
|
189
196
|
apidae_obj.meta_data = object_data[:metadonnees]
|
@@ -92,6 +92,7 @@ module Apidae
|
|
92
92
|
query_api(query_args, true, false)
|
93
93
|
end
|
94
94
|
|
95
|
+
# Note : WARNING - updated obj will only contain the provided fields
|
95
96
|
def add_or_refresh_obj(apidae_obj_id, fields = ["@all"])
|
96
97
|
if valid_api?
|
97
98
|
res = api_object(apidae_obj_id, fields)
|
@@ -102,6 +103,7 @@ module Apidae
|
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
106
|
+
# Note : WARNING - updated objs will only contain the provided fields
|
105
107
|
def add_or_refresh_objs(fields = ["@all"])
|
106
108
|
if valid_api?
|
107
109
|
res = api_objects({fields: fields})
|
@@ -8,9 +8,10 @@ module Apidae
|
|
8
8
|
LOCALE_ZH = 'zh'
|
9
9
|
LOCALE_ES = 'es'
|
10
10
|
LOCALE_PT_BR = 'pt-BR'
|
11
|
+
LOCALE_JP = 'jp'
|
11
12
|
|
12
13
|
DEFAULT_LOCALE = LOCALE_FR
|
13
|
-
ALL_LOCALES = [LOCALE_FR, LOCALE_EN, LOCALE_IT, LOCALE_DE, LOCALE_NL, LOCALE_RU, LOCALE_ZH, LOCALE_ES, LOCALE_PT_BR]
|
14
|
+
ALL_LOCALES = [LOCALE_FR, LOCALE_EN, LOCALE_IT, LOCALE_DE, LOCALE_NL, LOCALE_RU, LOCALE_ZH, LOCALE_ES, LOCALE_PT_BR, LOCALE_JP]
|
14
15
|
|
15
16
|
STANDARD_VERSION = 'STANDARD'
|
16
17
|
WINTER_VERSION = 'HIVER'
|
@@ -24,8 +25,11 @@ module Apidae
|
|
24
25
|
ALL_VERSIONS = [STANDARD_VERSION, WINTER_VERSION, SUMMER_VERSION, CHALLENGED_VERSION, BUSINESS_VERSION,
|
25
26
|
GROUPS_VERSION, ACTIVITIES_VERSION]
|
26
27
|
|
27
|
-
LOCALIZED_FIELDS = [:title, :short_desc, :long_desc, :pictures, :attachments,
|
28
|
-
:includes, :excludes, :extra, :booking_desc]
|
29
|
-
ALL_FIELDS = LOCALIZED_FIELDS + [:theme_desc, :private_desc, :capacity, :telephone, :email, :website,
|
30
|
-
:
|
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, :capacity, :telephone, :email, :website,
|
31
|
+
:google, :facebook, :twitter, :yelp, :trip_advisor, :fax, :mobile_website, :shorty_url,
|
32
|
+
:openings, :openings_extra, :rates, :services, :payment_methods, :categories, :themes,
|
33
|
+
:labels, :chains, :classification, :challenged, :environments, :languages, :products,
|
34
|
+
:animals, :equipments, :comfort, :activities, :promo, :internal, :linked]
|
31
35
|
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: 1.2.
|
4
|
+
version: 1.2.10
|
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-
|
11
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|