apidae 1.3.9 → 1.3.12

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
  SHA256:
3
- metadata.gz: 66681e7a228d04a5be420fea1d27f363dab5f3abd1431cfcfc9ddc00e1931bc1
4
- data.tar.gz: 6872e5a2de4d23d368b00c7bb01639113afc5b1133952ce793a12e7f372885f8
3
+ metadata.gz: da5768b591408dcf9f2fdadd5ab979b69ef1fcdb0de84c3a9c9eccb5ca11f744
4
+ data.tar.gz: 4fca91b7f71cc833947426fcd31390c8f94bf7bdff8d196cc176f9bf37c64cf5
5
5
  SHA512:
6
- metadata.gz: 45e6cf33a4d259a15576d28936fa7f8fc917cf4538d00c8bfec03b45b0bdde200c6cd6d536884030d2fa9d86a2313ec9e63b2bd190ff65ec6e395a19c6310acc
7
- data.tar.gz: 40040d7672373c353358d5cba94c10f296eb6d810868d698ad11f0090456c3897c33b2838a8aeeac974bb4465f7420f37a5c5eca09cf91d40572ef4c589735b1
6
+ metadata.gz: a980dbfb064064fed555cf9f6a58a73ae25d44c1c41b604a0a5afaad67982d3cf58468e2816079ff4d2a158c0c50c3920ac463df538146cf388499eb97c1058a
7
+ data.tar.gz: efb3d85c63fe98fdc066d3f9b73fcbe2c9c058d0669fc579324c874cdac1b6eeb07e4aadb2bc265904b8878a3004a32c6c6bec6703374edefc4eed990d4c7958
@@ -37,6 +37,7 @@ module Apidae
37
37
  def run
38
38
  success = true
39
39
  Export.pending.each do |e|
40
+ e.update(status: Export::IN_PROGRESS)
40
41
  success &&= e.import_data
41
42
  end
42
43
  success ? head(:ok) : head(:internal_server_error)
@@ -286,8 +286,8 @@ module Apidae
286
286
  tricky_sections: apidae_obj.apidae_type == Obj::EQU ? node_value(data_hash[:itineraire], :passagesDelicats, *locales) : nil,
287
287
  products: lists_ids(data_hash[:typesProduit], data_hash[:aopAocIgps], data_hash[:specialites]),
288
288
  audience: lists_ids(prestations_hash[:typesClientele]),
289
- animals: {allowed: prestations_hash[:animauxAcceptes] == 'ACCEPTES', desc: node_value(prestations_hash, :descriptifAnimauxAcceptes, *locales),
290
- fee: prestations_hash[:animauxAcceptesSupplement] == 'AVEC_SUPPLEMENT'},
289
+ animals: {allowed: prestations_hash[:animauxAcceptes] == 'ACCEPTES', unknown: prestations_hash[:animauxAcceptes] == 'NON_DISPONIBLE',
290
+ desc: node_value(prestations_hash, :descriptifAnimauxAcceptes, *locales), fee: prestations_hash[:animauxAcceptesSupplement] == 'AVEC_SUPPLEMENT'},
291
291
  extra: apidae_obj.apidae_type == Obj::SPA ? node_value(data_hash, :formuleHebergement, *locales) : node_value(prestations_hash, :complementAccueil, *locales),
292
292
  duration: apidae_obj.apidae_type == Obj::SPA ? {days: data_hash[:nombreJours], nights: data_hash[:nombreNuits]} : data_hash[:dureeSeance],
293
293
  certifications: data_hash[:agrements].blank? ? [] : data_hash[:agrements].map {|a| {id: a[:type][:id], identifier: a[:numero]}},
@@ -370,7 +370,11 @@ module Apidae
370
370
  end
371
371
 
372
372
  def self.node_id(node, key)
373
- node[key][:id] if node && node[key]
373
+ if node && node[key]
374
+ node[key].is_a?(Array) ? node[key][0][:id] : node[key][:id]
375
+ else
376
+ nil
377
+ end
374
378
  end
375
379
 
376
380
  private
@@ -5,6 +5,7 @@ module Apidae
5
5
  class Export < ActiveRecord::Base
6
6
 
7
7
  PENDING = 'pending'
8
+ IN_PROGRESS = 'in_progress'
8
9
  COMPLETE = 'complete'
9
10
  CANCELLED = 'cancelled'
10
11
 
@@ -24,6 +25,10 @@ module Apidae
24
25
  where(remote_status: 'SUCCESS', status: PENDING).order(:id)
25
26
  end
26
27
 
28
+ def self.in_progress
29
+ where(remote_status: 'SUCCESS', status: IN_PROGRESS)
30
+ end
31
+
27
32
  def import_data
28
33
  success = true
29
34
  begin
@@ -80,11 +80,10 @@ module Apidae
80
80
  STR = 'STRUCTURE'
81
81
  TER = 'TERRITOIRE'
82
82
 
83
- # Todo : subtype for DEG shoud be :statutsExploitant (double check and fix in 1.2 and master)
84
83
  TYPES_DATA = {
85
84
  ACT => {node: :informationsActivite, subtype: :activiteType},
86
85
  COS => {node: :informationsCommerceEtService, subtype: :commerceEtServiceType},
87
- DEG => {node: :informationsDegustation, subtype: :degustationType},
86
+ DEG => {node: :informationsDegustation, subtype: :statutsExploitant},
88
87
  DOS => {node: :informationsDomaineSkiable, subtype: :domaineSkiableType},
89
88
  EQU => {node: :informationsEquipement, subtype: :rubrique},
90
89
  FEM => {node: :informationsFeteEtManifestation, subtype: :feteEtManifestationType},
@@ -1,3 +1,3 @@
1
1
  module Apidae
2
- VERSION = "1.3.9"
2
+ VERSION = "1.3.12"
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.3.9
4
+ version: 1.3.12
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: 2022-05-03 00:00:00.000000000 Z
11
+ date: 2022-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails