diff options
| author | Robert | 2017-07-17 15:34:33 +0200 |
|---|---|---|
| committer | Robert | 2017-07-19 08:40:03 +0200 |
| commit | 0c69d141911a1f8e55c50d521691506ba7f32ac0 (patch) | |
| tree | ff6f6586c6a24d0e4fc56683da3ab139178fdb0e /app/controllers/api/v1 | |
| parent | eac2dc45fdf6c7dbaa413396ea513b1642b32c1c (diff) | |
| download | chouette-core-0c69d141911a1f8e55c50d521691506ba7f32ac0.tar.bz2 | |
Refs: #3506@16h Request Spec for NetexImport API and implementation
- Carrier Wave Upload with `fixture_file_upload`
- Request specs to .json
- Implementation
- API token setup
- Refuted experiments with controller specs
Diffstat (limited to 'app/controllers/api/v1')
| -rw-r--r-- | app/controllers/api/v1/netex_imports_controller.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/controllers/api/v1/netex_imports_controller.rb b/app/controllers/api/v1/netex_imports_controller.rb new file mode 100644 index 000000000..16a7cef69 --- /dev/null +++ b/app/controllers/api/v1/netex_imports_controller.rb @@ -0,0 +1,26 @@ +module Api + module V1 + class NetexImportsController < ChouetteController + + def create + respond_to do | format | + format.json do + @import = NetexImport.create(netex_import_params) + unless @import.valid? + render json: {errors: @import.errors}, status: 406 + end + end + end + end + + + private + + def netex_import_params + params + .require('netex_import') + .permit(:file, :name, :referential_id) + end + end + end +end |
