apidae 0.1.4 → 0.1.5

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: 53e626dd8145c8030532064c825d7170f96f18aa
4
- data.tar.gz: 4b41767bda21a36f83402066638a5e9656e4677a
3
+ metadata.gz: 92ec7ce5a586513ed8c0ba161d3d9484555f9668
4
+ data.tar.gz: f000d972759069c7c6a1ad8eb6a7048c728212f6
5
5
  SHA512:
6
- metadata.gz: 2609dced9fe025ff9e3f7d410482bd6ce67eb621d05668be49568db75cd207d0ad437bff3e1d7301b5c8add6eb0fe81ae7ec3d713285ddbc872fdf7bb77c6cf4
7
- data.tar.gz: ff23e2f694ef53d0ab543945b9267b394f88d5c430a67cb6427f87636a4917dacf299c94d2cc14c08404d1fd5c9b1a72a6aae3eb6111d5f81317bb30b5134ccb
6
+ metadata.gz: ea85265ae673330192ee48320ceb138831144be753063290280ee37f2dd87435c09485a21c62fff2977c3e091a376e265e8ed5be2f4a8af4969d3048e960e4f9
7
+ data.tar.gz: f235d3f3cae3c8f1cfffc09bedae71e7592849baccc240077bd033633453e43d19f6797f356bf646344d5afcb78b4fe562000949aef9937160dbcdea533c31ff
@@ -33,20 +33,27 @@ module Apidae
33
33
  def run
34
34
  success = true
35
35
  Export.pending.each do |e|
36
- open(e.file_url) do |f|
37
- begin
38
- FileImport.import(f)
39
- uri = URI(e.confirm_url)
40
- req = Net::HTTP::Post.new(uri)
41
- Net::HTTP.start(uri.hostname, uri.port) do |http|
42
- http.request(req)
36
+ begin
37
+ open(e.file_url) do |f|
38
+ begin
39
+ FileImport.import(f)
40
+ uri = URI(e.confirm_url)
41
+ req = Net::HTTP::Post.new(uri)
42
+ Net::HTTP.start(uri.hostname, uri.port) do |http|
43
+ http.request(req)
44
+ end
45
+ e.update(status: Export::COMPLETE)
46
+ rescue Exception => ex
47
+ logger.error("Failed to import export file : #{e.file_url}")
48
+ logger.error("Error is : #{ex}")
49
+ success = false
43
50
  end
44
- e.update(status: Export::COMPLETE)
45
- rescue Exception => ex
46
- logger.error("Failed to retrieve export file : #{ex.file_url}")
47
- logger.error("Error is : #{ex}")
48
- success = false
49
51
  end
52
+ rescue OpenURI::HTTPError => err
53
+ logger.error("Failed to download export file : #{e.file_url}")
54
+ logger.error("Error is : #{err}")
55
+ success = false
56
+ e.update(status: Export::CANCELLED)
50
57
  end
51
58
  end
52
59
  render nothing: true, status: (success ? :ok : :internal_server_error)
@@ -3,6 +3,7 @@ module Apidae
3
3
 
4
4
  PENDING = 'pending'
5
5
  COMPLETE = 'complete'
6
+ CANCELLED = 'cancelled'
6
7
 
7
8
  # Note : handle reset case
8
9
  def self.pending
@@ -1,3 +1,3 @@
1
1
  module Apidae
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
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: 0.1.4
4
+ version: 0.1.5
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: 2017-11-02 00:00:00.000000000 Z
11
+ date: 2018-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -206,70 +206,70 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  requirements: []
208
208
  rubyforge_project:
209
- rubygems_version: 2.5.1
209
+ rubygems_version: 2.6.13
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: A Ruby on Rails engine for projects that involve Apidae data
213
213
  test_files:
214
- - test/apidae_test.rb
215
- - test/controllers/apidae/dashboard_controller_test.rb
216
- - test/controllers/apidae/import_controller_test.rb
217
- - test/controllers/apidae/objects_controller_test.rb
218
- - test/controllers/apidae/selections_controller_test.rb
219
- - test/data/delete_selections.json
220
- - test/data/deletion.json
221
- - test/data/json_export.zip
222
- - test/data/selections.json
223
- - test/data/structure.json
224
- - test/data/update_selections.json
214
+ - test/dummy/app/controllers/application_controller.rb
215
+ - test/dummy/app/views/layouts/application.html.erb
225
216
  - test/dummy/app/assets/javascripts/application.js
226
217
  - test/dummy/app/assets/stylesheets/application.css
227
- - test/dummy/app/controllers/application_controller.rb
228
218
  - test/dummy/app/helpers/application_helper.rb
229
- - test/dummy/app/views/layouts/application.html.erb
230
- - test/dummy/bin/bundle
231
- - test/dummy/bin/rails
232
219
  - test/dummy/bin/rake
233
220
  - test/dummy/bin/setup
234
- - test/dummy/config/application.rb
235
- - test/dummy/config/boot.rb
236
- - test/dummy/config/database.yml
237
- - test/dummy/config/environment.rb
238
- - test/dummy/config/environments/development.rb
221
+ - test/dummy/bin/bundle
222
+ - test/dummy/bin/rails
223
+ - test/dummy/config/secrets.yml
224
+ - test/dummy/config/routes.rb
225
+ - test/dummy/config/locales/en.yml
239
226
  - test/dummy/config/environments/production.rb
227
+ - test/dummy/config/environments/development.rb
240
228
  - test/dummy/config/environments/test.rb
241
- - test/dummy/config/initializers/assets.rb
229
+ - test/dummy/config/environment.rb
230
+ - test/dummy/config/application.rb
231
+ - test/dummy/config/database.yml
232
+ - test/dummy/config/boot.rb
242
233
  - test/dummy/config/initializers/backtrace_silencers.rb
243
- - test/dummy/config/initializers/cookies_serializer.rb
244
- - test/dummy/config/initializers/filter_parameter_logging.rb
245
- - test/dummy/config/initializers/inflections.rb
246
234
  - test/dummy/config/initializers/mime_types.rb
235
+ - test/dummy/config/initializers/filter_parameter_logging.rb
247
236
  - test/dummy/config/initializers/session_store.rb
248
- - test/dummy/config/initializers/to_time_preserves_timezone.rb
249
237
  - test/dummy/config/initializers/wrap_parameters.rb
250
- - test/dummy/config/locales/en.yml
251
- - test/dummy/config/routes.rb
252
- - test/dummy/config/secrets.yml
238
+ - test/dummy/config/initializers/assets.rb
239
+ - test/dummy/config/initializers/cookies_serializer.rb
240
+ - test/dummy/config/initializers/to_time_preserves_timezone.rb
241
+ - test/dummy/config/initializers/inflections.rb
253
242
  - test/dummy/config.ru
254
- - test/dummy/db/schema.rb
255
- - test/dummy/log/development.log
256
- - test/dummy/log/test.log
257
- - test/dummy/public/404.html
243
+ - test/dummy/Rakefile
244
+ - test/dummy/public/favicon.ico
258
245
  - test/dummy/public/422.html
259
246
  - test/dummy/public/500.html
260
- - test/dummy/public/favicon.ico
261
- - test/dummy/Rakefile
247
+ - test/dummy/public/404.html
248
+ - test/dummy/db/schema.rb
249
+ - test/dummy/log/test.log
250
+ - test/dummy/log/development.log
262
251
  - test/dummy/README.rdoc
263
- - test/fixtures/apidae/attached_files.yml
264
- - test/fixtures/apidae/exports.yml
265
- - test/fixtures/apidae/objects.yml
266
- - test/fixtures/apidae/selections.yml
267
- - test/fixtures/apidae/towns.yml
268
252
  - test/integration/navigation_test.rb
269
- - test/models/apidae/attached_file_test.rb
270
- - test/models/apidae/export_test.rb
271
- - test/models/apidae/file_import_test.rb
272
253
  - test/models/apidae/object_test.rb
273
254
  - test/models/apidae/selection_test.rb
255
+ - test/models/apidae/file_import_test.rb
256
+ - test/models/apidae/export_test.rb
257
+ - test/models/apidae/attached_file_test.rb
274
258
  - test/models/apidae/town_test.rb
259
+ - test/fixtures/apidae/towns.yml
260
+ - test/fixtures/apidae/objects.yml
261
+ - test/fixtures/apidae/selections.yml
262
+ - test/fixtures/apidae/attached_files.yml
263
+ - test/fixtures/apidae/exports.yml
275
264
  - test/test_helper.rb
265
+ - test/apidae_test.rb
266
+ - test/controllers/apidae/selections_controller_test.rb
267
+ - test/controllers/apidae/objects_controller_test.rb
268
+ - test/controllers/apidae/dashboard_controller_test.rb
269
+ - test/controllers/apidae/import_controller_test.rb
270
+ - test/data/update_selections.json
271
+ - test/data/json_export.zip
272
+ - test/data/delete_selections.json
273
+ - test/data/structure.json
274
+ - test/data/deletion.json
275
+ - test/data/selections.json