apidae 1.3.0 → 1.3.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecf4dc2ccc60bf43998df20e62627e9f4ae8db4e
|
4
|
+
data.tar.gz: 716a338e66bba90e698ff4352c1bb81d398937fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f15e2f455ad96b75a6f9173b3626c5d5252eac4b57ef2df292b0a713d3a38d397d1091f7e3ab39f549bc73a8737158b1f77d0cb987148d255104ee87a77dc5d
|
7
|
+
data.tar.gz: 0f72c91e82ad9dc80bd70202fc67e0818583a5567e2e10985ed6d89b1b2ccba74a0d0452103e23a4652dc65a0ba730139148d743dd04f8575f5f61cf5c2a4373
|
@@ -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})
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Apidae
|
2
|
+
class Territory < ApplicationRecord
|
3
|
+
def self.import(territories_json)
|
4
|
+
territories_hashes = JSON.parse(territories_json, symbolize_names: true)
|
5
|
+
territories_hashes.each do |t_data|
|
6
|
+
t = Territory.find_or_initialize_by(apidae_id: t_data[:id])
|
7
|
+
t.name = t_data.dig(:nom, :libelleFr)
|
8
|
+
t.save!
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.import_file(json_file)
|
13
|
+
territories_json = File.read(json_file)
|
14
|
+
import(territories_json)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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.3.
|
4
|
+
version: 1.3.1
|
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-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- app/helpers/apidae/apidae_helper.rb
|
98
98
|
- app/helpers/apidae/application_helper.rb
|
99
99
|
- app/helpers/apidae/dashboard_helper.rb
|
100
|
+
- app/helpers/apidae/extendable_helper.rb
|
100
101
|
- app/helpers/apidae/import_helper.rb
|
101
102
|
- app/helpers/apidae/objects_helper.rb
|
102
103
|
- app/helpers/apidae/references_helper.rb
|
@@ -110,6 +111,7 @@ files:
|
|
110
111
|
- app/models/apidae/reference.rb
|
111
112
|
- app/models/apidae/selection.rb
|
112
113
|
- app/models/apidae/selection_object.rb
|
114
|
+
- app/models/apidae/territory.rb
|
113
115
|
- app/models/apidae/town.rb
|
114
116
|
- app/views/apidae/dashboard/index.html.erb
|
115
117
|
- app/views/apidae/import/_form.html.erb
|
@@ -187,6 +189,7 @@ files:
|
|
187
189
|
- db/migrate/20200312150904_add_version_index_on_apidae_objs.rb
|
188
190
|
- db/migrate/20200522124205_rename_objs_contact_to_contact_data.rb
|
189
191
|
- db/migrate/20200528101957_add_is_active_to_apidae_references.rb
|
192
|
+
- db/migrate/20201112080847_create_apidae_territories.rb
|
190
193
|
- lib/apidae.rb
|
191
194
|
- lib/apidae/engine.rb
|
192
195
|
- lib/apidae/version.rb
|