praxis 0.16.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +0 -1
- data/.ruby-version +1 -1
- data/.travis.yml +2 -1
- data/CHANGELOG.md +41 -0
- data/CONTRIBUTING.md +3 -0
- data/lib/api_browser/Gruntfile.js +20 -4
- data/lib/api_browser/app/bower_components/angular-mocks/.bower.json +6 -6
- data/lib/api_browser/app/bower_components/angular-mocks/README.md +11 -5
- data/lib/api_browser/app/bower_components/angular-mocks/angular-mocks.js +475 -216
- data/lib/api_browser/app/bower_components/angular-mocks/bower.json +2 -2
- data/lib/api_browser/app/bower_components/angular-mocks/ngAnimateMock.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/ngMock.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/ngMockE2E.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/package.json +1 -1
- data/lib/api_browser/app/bower_components/angular-sanitize/.bower.json +8 -8
- data/lib/api_browser/app/bower_components/angular-sanitize/README.md +19 -5
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.js +186 -127
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.min.js +12 -10
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.min.js.map +3 -3
- data/lib/api_browser/app/bower_components/angular-sanitize/bower.json +3 -2
- data/lib/api_browser/app/bower_components/angular-sanitize/index.js +2 -0
- data/lib/api_browser/app/bower_components/angular-sanitize/package.json +26 -0
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/.bower.json +15 -8
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/bower.json +11 -3
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-csp.css +6 -0
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.js +1177 -453
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.min.js +4 -4
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap.js +1066 -404
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap.min.js +3 -3
- data/lib/api_browser/app/bower_components/angular-ui-router/.bower.json +5 -6
- data/lib/api_browser/app/bower_components/angular-ui-router/CHANGELOG.md +208 -3
- data/lib/api_browser/app/bower_components/angular-ui-router/CONTRIBUTING.md +65 -0
- data/lib/api_browser/app/bower_components/angular-ui-router/LICENSE +1 -1
- data/lib/api_browser/app/bower_components/angular-ui-router/README.md +36 -71
- data/lib/api_browser/app/bower_components/angular-ui-router/api/angular-ui-router.d.ts +126 -0
- data/lib/api_browser/app/bower_components/angular-ui-router/bower.json +1 -1
- data/lib/api_browser/app/bower_components/angular-ui-router/release/angular-ui-router.js +1902 -755
- data/lib/api_browser/app/bower_components/angular-ui-router/release/angular-ui-router.min.js +2 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/common.js +69 -23
- data/lib/api_browser/app/bower_components/angular-ui-router/src/resolve.js +15 -5
- data/lib/api_browser/app/bower_components/angular-ui-router/src/state.js +556 -295
- data/lib/api_browser/app/bower_components/angular-ui-router/src/stateDirectives.js +101 -42
- data/lib/api_browser/app/bower_components/angular-ui-router/src/stateFilters.js +6 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/templateFactory.js +2 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/urlMatcherFactory.js +822 -97
- data/lib/api_browser/app/bower_components/angular-ui-router/src/urlRouter.js +274 -120
- data/lib/api_browser/app/bower_components/angular-ui-router/src/viewDirective.js +33 -20
- data/lib/api_browser/app/bower_components/angular-ui-router/src/viewScroll.js +1 -1
- data/lib/api_browser/app/bower_components/angular/.bower.json +5 -5
- data/lib/api_browser/app/bower_components/angular/README.md +2 -5
- data/lib/api_browser/app/bower_components/angular/angular-csp.css +5 -8
- data/lib/api_browser/app/bower_components/angular/angular.js +12975 -6996
- data/lib/api_browser/app/bower_components/angular/angular.min.js +285 -213
- data/lib/api_browser/app/bower_components/angular/angular.min.js.gzip +0 -0
- data/lib/api_browser/app/bower_components/angular/angular.min.js.map +3 -3
- data/lib/api_browser/app/bower_components/angular/bower.json +1 -1
- data/lib/api_browser/app/bower_components/angular/index.js +2 -0
- data/lib/api_browser/app/bower_components/angular/package.json +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/.bower.json +31 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/CHANGELOG.md +108 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/CONTRIBUTING.md +55 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/README.md +147 -206
- data/lib/api_browser/app/bower_components/bootstrap-sass/bower.json +19 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.eot +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.svg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.ttf +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.woff +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/vendor/assets/javascripts/bootstrap.js +12 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/affix.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/alert.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/button.js +11 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/carousel.js +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/collapse.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/dropdown.js +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/modal.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/popover.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/scrollspy.js +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/tab.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/tooltip.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/transition.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/vendor/assets/stylesheets/bootstrap.scss +1 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_alerts.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_badges.scss +6 -6
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_breadcrumbs.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_button-groups.scss +7 -33
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_buttons.scss +2 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_carousel.scss +1 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_close.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_code.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_component-animations.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_dropdowns.scss +3 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_forms.scss +11 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_glyphicons.scss +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_grid.scss +12 -26
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_input-groups.scss +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_jumbotron.scss +8 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_labels.scss +6 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_list-group.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_media.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_mixins.scss +38 -51
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_modals.scss +2 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_navbar.scss +41 -53
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_navs.scss +0 -20
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_normalize.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_pager.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_pagination.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_panels.scss +11 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_popovers.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_print.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_progress-bars.scss +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_responsive-utilities.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_scaffolding.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_tables.scss +5 -18
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_theme.scss +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_thumbnails.scss +9 -3
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_tooltip.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_type.scss +54 -52
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_utilities.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_variables.scss +20 -11
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_wells.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/bootstrap.scss +0 -0
- data/lib/api_browser/app/bower_components/lodash/.bower.json +9 -13
- data/lib/api_browser/app/bower_components/lodash/LICENSE.txt +3 -3
- data/lib/api_browser/app/bower_components/lodash/bower.json +4 -7
- data/lib/api_browser/app/bower_components/lodash/lodash.js +12235 -0
- data/lib/api_browser/app/bower_components/lodash/lodash.min.js +98 -0
- data/lib/api_browser/app/index.html +0 -1
- data/lib/api_browser/app/js/app.js +2 -5
- data/lib/api_browser/app/js/controllers/action.js +21 -37
- data/lib/api_browser/app/js/controllers/controller.js +23 -1
- data/lib/api_browser/app/js/controllers/menu.js +46 -14
- data/lib/api_browser/app/js/controllers/type.js +2 -9
- data/lib/api_browser/app/js/directives/attribute_description.js +15 -5
- data/lib/api_browser/app/js/directives/attribute_table.js +6 -6
- data/lib/api_browser/app/js/directives/fixed_if_fits.js +20 -0
- data/lib/api_browser/app/js/directives/no_container.js +6 -6
- data/lib/api_browser/app/js/directives/type_placeholder.js +21 -0
- data/lib/api_browser/app/js/factories/Configuration.js +13 -0
- data/lib/api_browser/app/js/factories/Documentation.js +0 -3
- data/lib/api_browser/app/js/factories/normalize_attributes.js +19 -0
- data/lib/api_browser/app/js/factories/template_for.js +113 -0
- data/lib/api_browser/app/sass/modules/_body.scss +26 -4
- data/lib/api_browser/app/sass/modules/_sidebar.scss +68 -1
- data/lib/api_browser/app/sass/praxis.scss +1 -5
- data/lib/api_browser/app/sass/variables/_bootstrap-variables.scss +13 -4
- data/lib/api_browser/app/views/action.html +13 -17
- data/lib/api_browser/app/views/controller.html +32 -4
- data/lib/api_browser/app/views/directives/attribute_description.html +1 -1
- data/lib/api_browser/app/views/directives/attribute_description/{_default.html → default.html} +0 -0
- data/lib/api_browser/app/views/directives/attribute_description/example.html +13 -0
- data/lib/api_browser/app/views/directives/attribute_description/headers.html +8 -0
- data/lib/api_browser/app/views/directives/attribute_description/member_options.html +4 -0
- data/lib/api_browser/app/views/directives/attribute_description/values.html +14 -0
- data/lib/api_browser/app/views/directives/attribute_table.html +2 -2
- data/lib/api_browser/app/views/home.html +1 -3
- data/lib/api_browser/app/views/layout.html +3 -36
- data/lib/api_browser/app/views/menu.html +45 -0
- data/lib/api_browser/app/views/navbar.html +1 -1
- data/lib/api_browser/app/views/type.html +2 -2
- data/lib/api_browser/app/views/type/{_details.html → details.html} +6 -6
- data/lib/api_browser/app/views/types/embedded/default.html +10 -0
- data/lib/api_browser/app/views/types/embedded/links.html +11 -0
- data/lib/api_browser/app/views/types/embedded/struct.html +2 -0
- data/lib/api_browser/app/views/types/label/link.html +1 -0
- data/lib/api_browser/app/views/types/label/primitive.html +1 -0
- data/lib/api_browser/app/views/types/label/primitive_collection.html +1 -0
- data/lib/api_browser/app/views/types/label/type.html +1 -0
- data/lib/api_browser/app/views/types/label/type_collection.html +1 -0
- data/lib/api_browser/app/views/{directives/request_body/_default.html → types/standalone/default.html} +1 -1
- data/lib/api_browser/app/views/types/standalone/struct.html +1 -0
- data/lib/api_browser/bower.json +9 -9
- data/lib/api_browser/package.json +1 -1
- data/lib/praxis.rb +10 -4
- data/lib/praxis/action_definition.rb +16 -4
- data/lib/praxis/action_definition/headers_dsl_compiler.rb +5 -2
- data/lib/praxis/api_definition.rb +3 -1
- data/lib/praxis/api_general_info.rb +49 -5
- data/lib/praxis/application.rb +12 -4
- data/lib/praxis/bootloader.rb +1 -0
- data/lib/praxis/bootloader_stages/environment.rb +2 -0
- data/lib/praxis/bootloader_stages/routing.rb +1 -1
- data/lib/praxis/bootloader_stages/subgroup_loader.rb +1 -0
- data/lib/praxis/exceptions/validation.rb +7 -0
- data/lib/praxis/handlers/plain.rb +16 -0
- data/lib/praxis/handlers/xml.rb +4 -4
- data/lib/praxis/links.rb +13 -3
- data/lib/praxis/media_type_identifier.rb +3 -0
- data/lib/praxis/multipart/parser.rb +41 -48
- data/lib/praxis/multipart/part.rb +196 -3
- data/lib/praxis/request.rb +14 -11
- data/lib/praxis/request_stages/request_stage.rb +4 -0
- data/lib/praxis/request_stages/response.rb +10 -9
- data/lib/praxis/request_stages/validate.rb +1 -7
- data/lib/praxis/request_stages/validate_params_and_headers.rb +30 -5
- data/lib/praxis/request_stages/validate_payload.rb +14 -5
- data/lib/praxis/resource_definition.rb +117 -15
- data/lib/praxis/response.rb +6 -5
- data/lib/praxis/response_definition.rb +51 -5
- data/lib/praxis/responses/http.rb +5 -0
- data/lib/praxis/responses/multipart_ok.rb +51 -0
- data/lib/praxis/responses/validation_error.rb +7 -7
- data/lib/praxis/restful_doc_generator.rb +9 -4
- data/lib/praxis/route.rb +3 -2
- data/lib/praxis/router.rb +26 -16
- data/lib/praxis/router/rack.rb +51 -0
- data/lib/praxis/router/simple.rb +146 -0
- data/lib/praxis/routing_config.rb +2 -2
- data/lib/praxis/trait.rb +1 -1
- data/lib/praxis/types/fuzzy_hash.rb +49 -0
- data/lib/praxis/types/media_type_common.rb +1 -1
- data/lib/praxis/types/multipart.rb +47 -12
- data/lib/praxis/types/multipart_array.rb +320 -0
- data/lib/praxis/types/multipart_array/part_definition.rb +52 -0
- data/lib/praxis/validation_handler.rb +10 -0
- data/lib/praxis/version.rb +2 -2
- data/praxis.gemspec +3 -3
- data/spec/api_browser/directives/type_placeholder_spec.js +134 -0
- data/spec/api_browser/factories/normalize_attributes_spec.js +97 -0
- data/spec/api_browser/factories/template_for_spec.js +67 -0
- data/spec/functional_spec.rb +111 -45
- data/spec/praxis/action_definition_spec.rb +31 -7
- data/spec/praxis/api_definition_spec.rb +2 -2
- data/spec/praxis/api_general_info_spec.rb +25 -0
- data/spec/praxis/application_spec.rb +24 -11
- data/spec/praxis/handlers/xml_spec.rb +55 -33
- data/spec/praxis/links_spec.rb +18 -1
- data/spec/praxis/media_type_collection_spec.rb +1 -1
- data/spec/praxis/media_type_spec.rb +2 -2
- data/spec/praxis/multipart/parser_spec.rb +21 -13
- data/spec/praxis/plugins/praxis_mapper_plugin_spec.rb +1 -1
- data/spec/praxis/request_spec.rb +52 -24
- data/spec/praxis/{request_stages_action_spec.rb → request_stages/action_spec.rb} +1 -1
- data/spec/praxis/{request_stage_spec.rb → request_stages/request_stage_spec.rb} +0 -0
- data/spec/praxis/{request_stages_validate_spec.rb → request_stages/validate_spec.rb} +1 -1
- data/spec/praxis/resource_definition_spec.rb +30 -4
- data/spec/praxis/response_definition_spec.rb +60 -19
- data/spec/praxis/response_spec.rb +2 -2
- data/spec/praxis/responses/validation_error_spec.rb +33 -16
- data/spec/praxis/route_spec.rb +4 -2
- data/spec/praxis/router_spec.rb +28 -12
- data/spec/praxis/routing_config_spec.rb +11 -5
- data/spec/praxis/types/collection_spec.rb +1 -1
- data/spec/praxis/types/fuzzy_hash_spec.rb +20 -0
- data/spec/praxis/types/multipart_array/part_definition_spec.rb +5 -0
- data/spec/praxis/types/multipart_array_spec.rb +334 -0
- data/spec/praxis/types/multipart_spec.rb +14 -5
- data/spec/spec_app/app/controllers/instances.rb +20 -10
- data/spec/spec_app/app/controllers/volumes.rb +8 -4
- data/spec/spec_app/app/responses/bulk_response.rb +0 -6
- data/spec/spec_app/config/environment.rb +13 -0
- data/spec/spec_app/design/api.rb +7 -10
- data/spec/spec_app/design/media_types/instance.rb +3 -1
- data/spec/spec_app/design/resources/instances.rb +50 -41
- data/spec/spec_app/design/resources/volume_snapshots.rb +39 -0
- data/spec/spec_app/design/resources/volumes.rb +11 -6
- data/spec/spec_helper.rb +3 -1
- metadata +125 -218
- data/lib/api_browser/app/bower_components/angular-ui-router/src/compat.js +0 -146
- data/lib/api_browser/app/bower_components/bootstrap-sass/CNAME +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/DOCS-LICENSE +0 -319
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gemfile +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gemfile.lock +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gruntfile.js +0 -244
- data/lib/api_browser/app/bower_components/bootstrap-sass/LICENSE +0 -176
- data/lib/api_browser/app/bower_components/bootstrap-sass/LICENSE-MIT +0 -21
- data/lib/api_browser/app/bower_components/bootstrap-sass/Rakefile +0 -44
- data/lib/api_browser/app/bower_components/bootstrap-sass/_config.yml +0 -25
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/ads.html +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/footer.html +0 -34
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/header.html +0 -42
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-about.html +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-components.html +0 -137
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-css.html +0 -99
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-customize.html +0 -40
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-getting-started.html +0 -44
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-javascript.html +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-main.html +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/old-bs-docs.html +0 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/social-buttons.html +0 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/_layouts/default.html +0 -79
- data/lib/api_browser/app/bower_components/bootstrap-sass/_layouts/home.html +0 -47
- data/lib/api_browser/app/bower_components/bootstrap-sass/about.html +0 -93
- data/lib/api_browser/app/bower_components/bootstrap-sass/browserstack.json +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/components.html +0 -3689
- data/lib/api_browser/app/bower_components/bootstrap-sass/composer.json +0 -28
- data/lib/api_browser/app/bower_components/bootstrap-sass/css.html +0 -2674
- data/lib/api_browser/app/bower_components/bootstrap-sass/customize.html +0 -1715
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap-theme.css +0 -427
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap-theme.min.css +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap.css +0 -6350
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap.min.css +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/js/bootstrap.js +0 -2002
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/js/bootstrap.min.js +0 -9
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/css/docs.css +0 -1195
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/css/pygments-manni.css +0 -66
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/ico/favicon.png +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/application.js +0 -103
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/customizer.js +0 -332
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/filesaver.js +0 -169
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/holder.js +0 -404
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/ie8-responsive-file-warning.js +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/jszip.js +0 -1467
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/less.js +0 -9
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/raw-files.js +0 -3
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/uglify.js +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/carousel/carousel.css +0 -148
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/carousel/index.html +0 -206
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/grid/grid.css +0 -28
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/grid/index.html +0 -148
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron-narrow/index.html +0 -82
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron-narrow/jumbotron-narrow.css +0 -79
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron/index.html +0 -99
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron/jumbotron.css +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/justified-nav/index.html +0 -83
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/justified-nav/justified-nav.css +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-fixed-top/index.html +0 -91
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-fixed-top/navbar-fixed-top.css +0 -4
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-static-top/index.html +0 -92
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-static-top/navbar-static-top.css +0 -7
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar/index.html +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar/navbar.css +0 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/non-responsive/index.html +0 -101
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/non-responsive/non-responsive.css +0 -116
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/index.html +0 -130
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/offcanvas.css +0 -50
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/offcanvas.js +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/carousel.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/grid.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/jumbotron-narrow.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/jumbotron.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/justified-nav.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar-fixed.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar-static.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/non-responsive.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/offcanvas.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sign-in.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/starter-template.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sticky-footer-navbar.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sticky-footer.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/theme.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/signin/index.html +0 -50
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/signin/signin.css +0 -40
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/starter-template/index.html +0 -68
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/starter-template/starter-template.css +0 -7
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer-navbar/index.html +0 -91
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer-navbar/sticky-footer-navbar.css +0 -45
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer/index.html +0 -55
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer/sticky-footer.css +0 -38
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/theme/index.html +0 -384
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/theme/theme.css +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.svg +0 -229
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/getting-started.html +0 -1021
- data/lib/api_browser/app/bower_components/bootstrap-sass/index.html +0 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/javascript.html +0 -1983
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/index.html +0 -52
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/affix.js +0 -25
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/alert.js +0 -62
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/button.js +0 -116
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/carousel.js +0 -87
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/collapse.js +0 -164
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/dropdown.js +0 -219
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/modal.js +0 -196
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/phantom.js +0 -69
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/popover.js +0 -133
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/scrollspy.js +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/tab.js +0 -86
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/tooltip.js +0 -437
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/transition.js +0 -13
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/jquery.js +0 -6
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/qunit.css +0 -232
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/qunit.js +0 -1510
- data/lib/api_browser/app/bower_components/bootstrap-sass/package.json +0 -40
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.compat.js +0 -7157
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.compat.min.js +0 -61
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.js +0 -6785
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.min.js +0 -56
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.underscore.js +0 -4979
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.underscore.min.js +0 -39
- data/lib/api_browser/app/js/directives/attribute_table_row.js +0 -17
- data/lib/api_browser/app/js/directives/request_body.js +0 -25
- data/lib/api_browser/app/js/directives/request_headers.js +0 -17
- data/lib/api_browser/app/js/directives/request_parameters.js +0 -17
- data/lib/api_browser/app/js/directives/type_label.js +0 -52
- data/lib/api_browser/app/js/factories/PayloadTemplates.js +0 -10
- data/lib/api_browser/app/js/factories/TemplateProvider.js +0 -45
- data/lib/api_browser/app/js/factories/TypeTemplates.js +0 -11
- data/lib/api_browser/app/views/directives/attribute_description/_example.html +0 -13
- data/lib/api_browser/app/views/directives/attribute_description/_headers.html +0 -8
- data/lib/api_browser/app/views/directives/attribute_table_row/_default.html +0 -10
- data/lib/api_browser/app/views/directives/attribute_table_row/_links.html +0 -11
- data/lib/api_browser/app/views/directives/attribute_table_row/_struct.html +0 -2
- data/lib/api_browser/app/views/directives/request_body/_struct.html +0 -1
- data/lib/api_browser/app/views/resource/_actions.html +0 -27
@@ -21,7 +21,11 @@ describe Praxis::Multipart do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'with value type' do
|
24
|
-
let(:type)
|
24
|
+
let(:type) do
|
25
|
+
silence_warnings do
|
26
|
+
Praxis::Multipart.of(value: Integer)
|
27
|
+
end
|
28
|
+
end
|
25
29
|
its(['some_name']) { should eq(1) }
|
26
30
|
end
|
27
31
|
|
@@ -42,7 +46,7 @@ describe Praxis::Multipart do
|
|
42
46
|
form.add entity,'some_date'
|
43
47
|
end
|
44
48
|
|
45
|
-
let(:type) { Praxis::Multipart.construct(block) }
|
49
|
+
let(:type) { silence_warnings { Praxis::Multipart.construct(block) } }
|
46
50
|
|
47
51
|
its(['some_name']) { should eq(1) }
|
48
52
|
its(['some_date']) { should eq(date) }
|
@@ -61,7 +65,12 @@ describe Praxis::Multipart do
|
|
61
65
|
end
|
62
66
|
|
63
67
|
context '.example' do
|
64
|
-
let(:type)
|
68
|
+
let(:type) do
|
69
|
+
silence_warnings do
|
70
|
+
Praxis::Multipart.of(value: Instance)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
65
74
|
subject(:example) { type.example('example') }
|
66
75
|
|
67
76
|
it 'generates an interesting example' do
|
@@ -88,9 +97,9 @@ describe Praxis::Multipart do
|
|
88
97
|
end
|
89
98
|
|
90
99
|
it 'complains when the value is not a String (besides a Multipart instance or nil)' do
|
91
|
-
|
100
|
+
expect{
|
92
101
|
type.load( {a: "hash"} )
|
93
|
-
|
102
|
+
}.to raise_error(Attributor::CoercionError)
|
94
103
|
end
|
95
104
|
|
96
105
|
pending 'complete the load tests'
|
@@ -39,32 +39,42 @@ class Instances < BaseClass
|
|
39
39
|
#puts "Decorator three end"
|
40
40
|
end
|
41
41
|
|
42
|
-
def index(
|
42
|
+
def index(cloud_id:, response_content_type: 'application/vnd.acme.instance;type=collection', **params)
|
43
|
+
instances = Instance::Collection.example
|
44
|
+
response.body = JSON.pretty_generate(instances.collect { |i| i.render })
|
43
45
|
response.headers['Content-Type'] = response_content_type #'application/vnd.acme.instance;type=collection'
|
44
|
-
|
46
|
+
response
|
45
47
|
end
|
46
48
|
|
47
49
|
def show(cloud_id:, id:, junk:, **other_params)
|
48
50
|
payload = request.payload
|
49
51
|
response.body = {cloud_id: cloud_id, id: id, junk: junk, other_params: other_params, payload: payload && payload.dump}
|
50
|
-
response.headers['Content-Type'] = 'application/
|
52
|
+
response.headers['Content-Type'] = 'application/json'
|
51
53
|
response
|
52
54
|
end
|
53
55
|
|
54
56
|
def bulk_create(cloud_id:)
|
55
|
-
self.response =
|
57
|
+
self.response = Praxis::Responses::MultipartOk.new
|
58
|
+
response.body = request.action.responses[:multipart_ok].media_type.new
|
59
|
+
|
60
|
+
request.payload.each do |part|
|
61
|
+
instance_id = part.name
|
62
|
+
instance = part.payload
|
56
63
|
|
64
|
+
part_body = {
|
65
|
+
key: instance_id,
|
66
|
+
value: instance.render(view: :create)
|
67
|
+
}
|
57
68
|
|
58
|
-
request.payload.each do |instance_id,instance|
|
59
|
-
part_body = JSON.pretty_generate(key: instance_id, value: instance.render(:create))
|
60
69
|
headers = {
|
61
70
|
'Status' => '201',
|
62
|
-
'Content-Type' => Instance.identifier,
|
71
|
+
'Content-Type' => Instance.identifier + '+json',
|
63
72
|
'Location' => definition.to_href(cloud_id: cloud_id, id: instance.id)
|
64
73
|
}
|
65
|
-
part = Praxis::MultipartPart.new(part_body, headers)
|
66
74
|
|
67
|
-
|
75
|
+
part = Praxis::MultipartPart.new(part_body, headers, name: instance_id)
|
76
|
+
|
77
|
+
response.body.push(part)
|
68
78
|
end
|
69
79
|
|
70
80
|
response
|
@@ -105,7 +115,7 @@ class Instances < BaseClass
|
|
105
115
|
end
|
106
116
|
|
107
117
|
def exceptional(cloud_id:, splat:)
|
108
|
-
response.headers['Content-Type'] = 'application/
|
118
|
+
response.headers['Content-Type'] = 'application/json'
|
109
119
|
response
|
110
120
|
end
|
111
121
|
end
|
@@ -8,15 +8,19 @@ class Volumes < BaseClass
|
|
8
8
|
#puts "before action for volumes"
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
11
|
+
def index
|
12
|
+
volumes = Volume::Collection.example
|
13
|
+
|
14
|
+
response.body = volumes.collect { |v| v.render }
|
15
|
+
response.headers['Content-Type'] = 'application/vnd.acme.volumes'
|
14
16
|
response
|
15
17
|
end
|
16
18
|
|
17
|
-
def
|
19
|
+
def show(id:, **other_params)
|
20
|
+
response.body = JSON.pretty_generate(Volume.example.render)
|
18
21
|
response.headers['Content-Type'] = 'application/vnd.acme.volume'
|
19
22
|
response
|
20
23
|
end
|
21
24
|
|
25
|
+
|
22
26
|
end
|
@@ -14,6 +14,8 @@ end
|
|
14
14
|
|
15
15
|
Praxis::Application.configure do |application|
|
16
16
|
|
17
|
+
application.handler 'xml', Praxis::Handlers::XML
|
18
|
+
|
17
19
|
application.middleware SetHeader, 'Spec-Middleware', 'used'
|
18
20
|
|
19
21
|
application.bootloader.use SimpleAuthenticationPlugin, config_file: 'config/authentication.yml'
|
@@ -27,8 +29,19 @@ Praxis::Application.configure do |application|
|
|
27
29
|
|
28
30
|
# enable "development-mode" options
|
29
31
|
application.config.praxis.validate_responses = true
|
32
|
+
application.config.praxis.validate_response_bodies = true
|
30
33
|
application.config.praxis.show_exceptions = true
|
31
34
|
|
35
|
+
# FIXME: until we have a better way to unit test such a feature...
|
36
|
+
# Silly callback code pieces to test that the deferred callbacks work even for sub-stages
|
37
|
+
application.bootloader.after :app, :models do
|
38
|
+
PersonModel.identity(:other_id)
|
39
|
+
end
|
40
|
+
application.bootloader.after :app do
|
41
|
+
raise "After sub-stage hooks not working!" unless PersonModel.identities.include? :other_id
|
42
|
+
end
|
43
|
+
|
44
|
+
|
32
45
|
application.layout do
|
33
46
|
layout do
|
34
47
|
map :initializers, 'config/initializers/**/*'
|
data/spec/spec_app/design/api.rb
CHANGED
@@ -10,13 +10,7 @@ Praxis::ApiDefinition.define do
|
|
10
10
|
media_type 'multipart/form-data'
|
11
11
|
end
|
12
12
|
|
13
|
-
response_template :bulk_response do |media_type: nil, parts: |
|
14
|
-
status 200
|
15
|
-
media_type 'multipart/form-data'
|
16
13
|
|
17
|
-
parts[:media_type] ||= media_type if ( media_type && parts.kind_of?(Hash) )
|
18
|
-
parts(parts)
|
19
|
-
end
|
20
14
|
|
21
15
|
trait :authenticated do
|
22
16
|
headers do
|
@@ -28,11 +22,14 @@ Praxis::ApiDefinition.define do
|
|
28
22
|
name "Spec App"
|
29
23
|
title "A simple App to do some simple integration testing"
|
30
24
|
description "This example API should really be replaced by a set of more full-fledged example apps in the future"
|
25
|
+
|
26
|
+
base_path "/api"
|
27
|
+
#version_with :path
|
28
|
+
#base_path "/v:api_version"
|
31
29
|
end
|
32
|
-
|
33
|
-
info
|
30
|
+
|
31
|
+
info '1.0' do # Applies to 1.0 version (and inherits everything else form the global one)
|
34
32
|
description "A simple 1.0 App"
|
35
|
-
base_path "/"
|
36
33
|
end
|
37
|
-
|
34
|
+
|
38
35
|
end
|
@@ -17,7 +17,7 @@ module ApiResources
|
|
17
17
|
requires_ability :read
|
18
18
|
|
19
19
|
params do
|
20
|
-
attribute :cloud_id, Integer, required: true
|
20
|
+
attribute :cloud_id, Integer, required: true, min: 0
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -26,17 +26,19 @@ module ApiResources
|
|
26
26
|
get ''
|
27
27
|
end
|
28
28
|
|
29
|
-
params do
|
30
|
-
attribute :response_content_type, String, default: 'application/vnd.acme.instance;type=collection'
|
31
|
-
end
|
32
|
-
|
33
29
|
headers do
|
34
30
|
# BOTH ARE EQUIVALENT
|
35
31
|
#key "FOO", String, required: true
|
36
32
|
header "FOO", /bar/
|
33
|
+
key 'Account-Id', Integer, required: false, min: 0
|
34
|
+
end
|
35
|
+
|
36
|
+
params do
|
37
|
+
attribute :response_content_type, String, default: 'application/vnd.acme.instance;type=collection'
|
37
38
|
end
|
38
39
|
|
39
|
-
|
40
|
+
|
41
|
+
response :ok, Praxis::Collection.of(Instance)
|
40
42
|
end
|
41
43
|
|
42
44
|
action :show do
|
@@ -45,7 +47,7 @@ module ApiResources
|
|
45
47
|
get '/something/:id', name: :alternate
|
46
48
|
end
|
47
49
|
|
48
|
-
response :ok
|
50
|
+
response :ok, media_type: 'application/json'
|
49
51
|
response :unauthorized
|
50
52
|
|
51
53
|
params do
|
@@ -54,25 +56,50 @@ module ApiResources
|
|
54
56
|
attribute :some_date, DateTime, default: DateTime.parse('2012-12-21')
|
55
57
|
attribute :fail_filter, Attributor::Boolean, default: false
|
56
58
|
end
|
59
|
+
|
57
60
|
payload do
|
58
61
|
attribute :something, String
|
59
62
|
attribute :optional, String, default: "not given"
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
66
|
+
|
63
67
|
action :bulk_create do
|
64
68
|
routing do
|
65
69
|
post ''
|
66
70
|
end
|
67
71
|
|
68
|
-
payload Praxis::
|
72
|
+
payload Praxis::Types::MultipartArray do
|
73
|
+
name_type Integer
|
74
|
+
payload_type Instance
|
75
|
+
end
|
76
|
+
|
77
|
+
response :multipart_ok, Praxis::Types::MultipartArray do
|
78
|
+
name_type Integer
|
79
|
+
|
80
|
+
part /\d+/ do
|
81
|
+
header 'Status', '201'
|
82
|
+
header 'Content-Type', /^#{Instance.identifier}/
|
83
|
+
header 'Location', Attributor::URI,
|
84
|
+
example: proc { |part| ApiResources::Instances.to_href(cloud_id: part[:value].cloud_id, id: part[:value].id) }
|
85
|
+
|
86
|
+
payload Hash do
|
87
|
+
attribute :key, Integer, required: true
|
88
|
+
attribute :value, Hash, required: true, reference: Instance do
|
89
|
+
attribute :id
|
90
|
+
attribute :name
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
69
97
|
|
70
98
|
# Using a hash param for parts
|
71
|
-
response :
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
99
|
+
#response :multipart_ok, parts: {
|
100
|
+
# like: :created,
|
101
|
+
# location: /\/instances\//
|
102
|
+
#}
|
76
103
|
|
77
104
|
# Using a block for parts to defin a sub-request
|
78
105
|
# sub_request = proc do
|
@@ -81,30 +108,8 @@ module ApiResources
|
|
81
108
|
# headers ['X-Foo','X-Bar']
|
82
109
|
# end
|
83
110
|
# response :bulk_response, parts: sub_request
|
84
|
-
|
85
|
-
|
86
|
-
# multi 200, H1
|
87
|
-
# parts_as :resp1
|
88
|
-
|
89
|
-
# part_type do
|
90
|
-
# 201
|
91
|
-
# h Location ~= /asdfa/
|
92
|
-
# end
|
93
|
-
|
94
|
-
# part 'dest_dir' do
|
95
|
-
|
96
|
-
# end
|
97
|
-
# part 'file' do
|
98
|
-
# mt binary
|
99
|
-
# end
|
100
111
|
end
|
101
112
|
|
102
|
-
#action :get_user_data do
|
103
|
-
# response :get_user_data do
|
104
|
-
# media_type: UserData
|
105
|
-
# end
|
106
|
-
#end
|
107
|
-
|
108
113
|
action :attach_file do
|
109
114
|
routing do
|
110
115
|
post '/:id/files'
|
@@ -114,10 +119,13 @@ module ApiResources
|
|
114
119
|
attribute :id
|
115
120
|
end
|
116
121
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
122
|
+
# TODO: move to something else when Multipart is fully deprecated
|
123
|
+
silence_warnings do
|
124
|
+
payload Praxis::Multipart, allow_extra: true do
|
125
|
+
key 'destination_path', String, required: true
|
126
|
+
key 'file', Attributor::FileUpload, required: false
|
127
|
+
extra 'options'
|
128
|
+
end
|
121
129
|
end
|
122
130
|
|
123
131
|
response :ok, media_type: 'application/json'
|
@@ -166,7 +174,7 @@ module ApiResources
|
|
166
174
|
end
|
167
175
|
|
168
176
|
payload do
|
169
|
-
attribute :name
|
177
|
+
attribute :name, regexp: /.*/
|
170
178
|
attribute :root_volume
|
171
179
|
end
|
172
180
|
|
@@ -182,8 +190,9 @@ module ApiResources
|
|
182
190
|
params do
|
183
191
|
attribute :splat, Attributor::Collection.of(String), required: true
|
184
192
|
end
|
185
|
-
response :ok
|
193
|
+
response :ok, media_type: 'application/json'
|
186
194
|
end
|
195
|
+
|
187
196
|
# OTHER USAGES:
|
188
197
|
# note: these are all hypothetical, pending, brainstorming usages.
|
189
198
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative 'volumes'
|
2
|
+
|
3
|
+
module ApiResources
|
4
|
+
class VolumeSnapshots
|
5
|
+
include Praxis::ResourceDefinition
|
6
|
+
|
7
|
+
media_type VolumeSnapshot
|
8
|
+
|
9
|
+
version '1.0'
|
10
|
+
|
11
|
+
parent Volumes, :id => :volume_id
|
12
|
+
prefix '/snapshots'
|
13
|
+
|
14
|
+
action :index do
|
15
|
+
routing do
|
16
|
+
get ''
|
17
|
+
end
|
18
|
+
response :ok
|
19
|
+
response :unauthorized
|
20
|
+
|
21
|
+
params do
|
22
|
+
attribute :volume_id, Integer, description: 'id of parent volume'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
action :show do
|
28
|
+
routing do
|
29
|
+
get '/:id'
|
30
|
+
end
|
31
|
+
|
32
|
+
params do
|
33
|
+
attribute :id
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -3,17 +3,22 @@ module ApiResources
|
|
3
3
|
include Praxis::ResourceDefinition
|
4
4
|
|
5
5
|
media_type Volume
|
6
|
-
version '1.0'
|
7
|
-
|
8
|
-
prefix '/volumes'
|
6
|
+
version '1.0'
|
7
|
+
prefix '/clouds/:cloud_id/volumes'
|
9
8
|
|
10
9
|
trait :authenticated
|
11
|
-
|
10
|
+
|
11
|
+
action_defaults do
|
12
|
+
params do
|
13
|
+
attribute :cloud_id, Integer, description: "id of the cloud"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
12
17
|
action :index do
|
13
18
|
routing do
|
14
19
|
get ''
|
15
20
|
end
|
16
|
-
response :ok
|
21
|
+
response :ok, media_type: Praxis::Collection.of(Volume)
|
17
22
|
response :unauthorized
|
18
23
|
end
|
19
24
|
|
@@ -26,7 +31,7 @@ module ApiResources
|
|
26
31
|
response :unauthorized
|
27
32
|
|
28
33
|
params do
|
29
|
-
attribute :id
|
34
|
+
attribute :id, description: 'ID to find'
|
30
35
|
attribute :junk, String, default: ''
|
31
36
|
attribute :some_date, DateTime, default: DateTime.parse('2012-12-21')
|
32
37
|
end
|