apidae 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +0 -3
- data/app/models/apidae/file_import.rb +15 -15
- data/app/models/apidae/object.rb +3 -3
- data/db/migrate/20180521211735_destroy_attached_files.rb +5 -0
- data/lib/apidae/engine.rb +0 -2
- data/lib/apidae/version.rb +1 -1
- metadata +3 -21
- data/app/models/apidae/attached_file.rb +0 -31
- data/test/fixtures/apidae/attached_files.yml +0 -9
- data/test/models/apidae/attached_file_test.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b4943d71597ce361d404c235d5630f23748f5ca
|
4
|
+
data.tar.gz: a595282b4f3f3eecba84976962ccb141131d3bad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63f5f3b555d2232c104ba8bc8445e41edb3a491b21cdb5206ea3f01d62282cc3a1667c86314e990b199a50abc406c349a6d3f2d1ec6bbd0e50d573edb5118003
|
7
|
+
data.tar.gz: 0ced446f112cd964e50d80e8877464935b4c5e0b23f22aca087239f72abb6558f1710129c2fea9a528ec8dd1e4db0a7971a69380d73df334b96529bffc1420bb
|
data/Rakefile
CHANGED
@@ -117,21 +117,21 @@ module Apidae
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
def self.load_pictures
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
end
|
120
|
+
# def self.load_pictures
|
121
|
+
# Apidae::Object.all.each do |obj|
|
122
|
+
# if obj.apidae_attached_files.blank? && obj.pictures.any?
|
123
|
+
# obj.pictures.each do |pic|
|
124
|
+
# begin
|
125
|
+
# attached = Apidae::AttachedFile.new(apidae_object_id: id, name: pic[:name], picture: URI.parse(pic[:url]),
|
126
|
+
# description: pic[:description], credits: pic[:credits])
|
127
|
+
# attached.save
|
128
|
+
# rescue OpenURI::HTTPError => e
|
129
|
+
# logger.error "Could not retrieve attached picture for object #{title} - Error is #{e.message}"
|
130
|
+
# end
|
131
|
+
# end
|
132
|
+
# end
|
133
|
+
# end
|
134
|
+
# end
|
135
135
|
|
136
136
|
def self.import_selections(json_file, result)
|
137
137
|
selections_json = File.read(json_file)
|
data/app/models/apidae/object.rb
CHANGED
@@ -2,7 +2,7 @@ module Apidae
|
|
2
2
|
class Object < ActiveRecord::Base
|
3
3
|
|
4
4
|
belongs_to :town, class_name: 'Apidae::Town', foreign_key: :town_insee_code, primary_key: :insee_code
|
5
|
-
has_many :attached_files, class_name: 'Apidae::AttachedFile'
|
5
|
+
# has_many :attached_files, class_name: 'Apidae::AttachedFile'
|
6
6
|
has_many :apidae_selection_objects, class_name: 'Apidae::SelectionObject', foreign_key: :apidae_object_id
|
7
7
|
has_many :selections, class_name: 'Apidae::Selection', source: :apidae_selection, through: :apidae_selection_objects
|
8
8
|
|
@@ -197,12 +197,12 @@ module Apidae
|
|
197
197
|
capacity: data_hash[:capacite],
|
198
198
|
classification: nodes_ids(data_hash[:classement], data_hash[:classementPrefectoral], data_hash[:classification]) +
|
199
199
|
lists_ids(data_hash[:classementsGuides]) + lists_ids(data_hash[:classements]),
|
200
|
-
labels: lists_ids(data_hash[:labels], prestations_hash[:labelsTourismeHandicap]
|
200
|
+
labels: lists_ids(data_hash[:labels], prestations_hash[:labelsTourismeHandicap]) +
|
201
201
|
(node_id(data_hash, :typeLabel) ? [node_id(data_hash, :typeLabel)] : []),
|
202
202
|
chains: lists_ids(data_hash[:chaines]) + nodes_ids(data_hash[:chaineEtLabel]),
|
203
203
|
area: apidae_obj.apidae_type == DOS ? data_hash.except(:classification) : nil,
|
204
204
|
track: apidae_obj.apidae_type == EQU ? data_hash[:itineraire] : nil,
|
205
|
-
products: lists_ids(data_hash[:typesProduit]),
|
205
|
+
products: lists_ids(data_hash[:typesProduit], data_hash[:aopAocIgps]),
|
206
206
|
audience: lists_ids(prestations_hash[:typesClientele]),
|
207
207
|
animals: prestations_hash[:animauxAcceptes] == 'ACCEPTES',
|
208
208
|
extra: node_value(prestations_hash, :complementAccueil),
|
data/lib/apidae/engine.rb
CHANGED
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: 0.4.
|
4
|
+
version: 0.4.4
|
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: 2018-05-
|
11
|
+
date: 2018-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 5.1.4
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: paperclip
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '5.1'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '5.1'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: pg
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,7 +78,6 @@ files:
|
|
92
78
|
- app/helpers/apidae/objects_helper.rb
|
93
79
|
- app/helpers/apidae/selections_helper.rb
|
94
80
|
- app/models/apidae/application_record.rb
|
95
|
-
- app/models/apidae/attached_file.rb
|
96
81
|
- app/models/apidae/export.rb
|
97
82
|
- app/models/apidae/file_import.rb
|
98
83
|
- app/models/apidae/object.rb
|
@@ -144,6 +129,7 @@ files:
|
|
144
129
|
- db/migrate/20180418141305_remove_desc_columns_from_apidae_objects.rb
|
145
130
|
- db/migrate/20180424141656_add_meta_data_to_apidae_references.rb
|
146
131
|
- db/migrate/20180519170210_remove_insee_code_unicity.rb
|
132
|
+
- db/migrate/20180521211735_destroy_attached_files.rb
|
147
133
|
- lib/apidae.rb
|
148
134
|
- lib/apidae/engine.rb
|
149
135
|
- lib/apidae/version.rb
|
@@ -198,7 +184,6 @@ files:
|
|
198
184
|
- test/dummy/public/422.html
|
199
185
|
- test/dummy/public/500.html
|
200
186
|
- test/dummy/public/favicon.ico
|
201
|
-
- test/fixtures/apidae/attached_files.yml
|
202
187
|
- test/fixtures/apidae/exports.yml
|
203
188
|
- test/fixtures/apidae/objects.yml
|
204
189
|
- test/fixtures/apidae/references.yml
|
@@ -206,7 +191,6 @@ files:
|
|
206
191
|
- test/fixtures/apidae/selections.yml
|
207
192
|
- test/fixtures/apidae/towns.yml
|
208
193
|
- test/integration/navigation_test.rb
|
209
|
-
- test/models/apidae/attached_file_test.rb
|
210
194
|
- test/models/apidae/export_test.rb
|
211
195
|
- test/models/apidae/file_import_test.rb
|
212
196
|
- test/models/apidae/object_test.rb
|
@@ -285,14 +269,12 @@ test_files:
|
|
285
269
|
- test/models/apidae/file_import_test.rb
|
286
270
|
- test/models/apidae/export_test.rb
|
287
271
|
- test/models/apidae/reference_test.rb
|
288
|
-
- test/models/apidae/attached_file_test.rb
|
289
272
|
- test/models/apidae/town_test.rb
|
290
273
|
- test/fixtures/apidae/selection_objects.yml
|
291
274
|
- test/fixtures/apidae/towns.yml
|
292
275
|
- test/fixtures/apidae/references.yml
|
293
276
|
- test/fixtures/apidae/objects.yml
|
294
277
|
- test/fixtures/apidae/selections.yml
|
295
|
-
- test/fixtures/apidae/attached_files.yml
|
296
278
|
- test/fixtures/apidae/exports.yml
|
297
279
|
- test/test_helper.rb
|
298
280
|
- test/apidae_test.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Apidae
|
2
|
-
class AttachedFile < ActiveRecord::Base
|
3
|
-
belongs_to :apidae_object, :class_name => 'Apidae::Object'
|
4
|
-
|
5
|
-
has_attached_file :picture,
|
6
|
-
{
|
7
|
-
:styles => {
|
8
|
-
:xlarge => ['1600x1200>', :jpg],
|
9
|
-
:large => ['1280x960>', :jpg],
|
10
|
-
:medium => ['800x600>', :jpg],
|
11
|
-
:small => ['320x240', :jpg],
|
12
|
-
:thumb => ['200x200>', :png]
|
13
|
-
},
|
14
|
-
:default_url => "/#{Rails.application.config.apidae_pictures_path}/default/logo.png",
|
15
|
-
:path => "public/#{Rails.application.config.apidae_pictures_path}/:apidae_type/:apidae_id/:basename.:extension",
|
16
|
-
:url => "/#{Rails.application.config.apidae_pictures_path}/:apidae_type/:apidae_id/:basename.:extension"
|
17
|
-
}
|
18
|
-
|
19
|
-
validates_attachment :picture, content_type: { content_type: /\Aimage\/.*\Z/ }
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
Paperclip.interpolates :apidae_type do |attachment, style|
|
24
|
-
attachment.instance.apidae_object.apidae_type.downcase
|
25
|
-
end
|
26
|
-
|
27
|
-
Paperclip.interpolates :apidae_id do |attachment, style|
|
28
|
-
attachment.instance.apidae_object.apidae_id
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|