sequencescape-client-api 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +1 -0
- data/.rvmrc +52 -0
- data/.yardoc/checksums +96 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +4 -0
- data/README.markdown +4 -0
- data/Rakefile +2 -0
- data/doc/Array.html +192 -0
- data/doc/BaitLibrary.html +139 -0
- data/doc/Hash.html +242 -0
- data/doc/NilClass.html +214 -0
- data/doc/Sequencescape/Api/Actions/ClassActionHelpers.html +213 -0
- data/doc/Sequencescape/Api/Actions/InstanceActionHelpers.html +282 -0
- data/doc/Sequencescape/Api/Actions.html +197 -0
- data/doc/Sequencescape/Api/Associations/Base/InstanceMethods.html +352 -0
- data/doc/Sequencescape/Api/Associations/Base.html +237 -0
- data/doc/Sequencescape/Api/Associations/BelongsTo/AssociationProxy.html +332 -0
- data/doc/Sequencescape/Api/Associations/BelongsTo/CommonBehaviour/LoadHandler.html +279 -0
- data/doc/Sequencescape/Api/Associations/BelongsTo/CommonBehaviour.html +432 -0
- data/doc/Sequencescape/Api/Associations/BelongsTo/InlineAssociationProxy.html +173 -0
- data/doc/Sequencescape/Api/Associations/BelongsTo.html +212 -0
- data/doc/Sequencescape/Api/Associations/HasMany/AssociationProxy.html +366 -0
- data/doc/Sequencescape/Api/Associations/HasMany/InlineAssociationProxy.html +529 -0
- data/doc/Sequencescape/Api/Associations/HasMany/Json.html +250 -0
- data/doc/Sequencescape/Api/Associations/HasMany/Validation/CompositeErrors.html +493 -0
- data/doc/Sequencescape/Api/Associations/HasMany/Validation.html +245 -0
- data/doc/Sequencescape/Api/Associations/HasMany.html +212 -0
- data/doc/Sequencescape/Api/Associations/InstanceMethods/CompositeErrors.html +379 -0
- data/doc/Sequencescape/Api/Associations/InstanceMethods.html +496 -0
- data/doc/Sequencescape/Api/Associations.html +201 -0
- data/doc/Sequencescape/Api/BasicErrorHandling.html +371 -0
- data/doc/Sequencescape/Api/Composition/Target.html +262 -0
- data/doc/Sequencescape/Api/Composition.html +215 -0
- data/doc/Sequencescape/Api/ConnectionFactory/Actions.html +611 -0
- data/doc/Sequencescape/Api/ConnectionFactory/Helpers.html +233 -0
- data/doc/Sequencescape/Api/ConnectionFactory.html +321 -0
- data/doc/Sequencescape/Api/ErrorHandling/TurnOffValidationOfUuidOnlyRecords.html +189 -0
- data/doc/Sequencescape/Api/ErrorHandling.html +201 -0
- data/doc/Sequencescape/Api/FinderMethods/AllHandler.html +279 -0
- data/doc/Sequencescape/Api/FinderMethods/Caching.html +183 -0
- data/doc/Sequencescape/Api/FinderMethods/Delegation.html +189 -0
- data/doc/Sequencescape/Api/FinderMethods/FindByUuidHandler.html +279 -0
- data/doc/Sequencescape/Api/FinderMethods.html +364 -0
- data/doc/Sequencescape/Api/GeneralError.html +176 -0
- data/doc/Sequencescape/Api/JsonError.html +205 -0
- data/doc/Sequencescape/Api/ModifyingHandler.html +359 -0
- data/doc/Sequencescape/Api/PageOfResults/UpdateHandler.html +279 -0
- data/doc/Sequencescape/Api/PageOfResults.html +611 -0
- data/doc/Sequencescape/Api/Rails/ApplicationController.html +207 -0
- data/doc/Sequencescape/Api/Rails/Resourced.html +269 -0
- data/doc/Sequencescape/Api/Rails.html +117 -0
- data/doc/Sequencescape/Api/Resource/ActiveModel.html +287 -0
- data/doc/Sequencescape/Api/Resource/Attributes/InstanceMethods.html +272 -0
- data/doc/Sequencescape/Api/Resource/Attributes.html +199 -0
- data/doc/Sequencescape/Api/Resource/Groups/InstanceMethods.html +378 -0
- data/doc/Sequencescape/Api/Resource/Groups/Json.html +112 -0
- data/doc/Sequencescape/Api/Resource/Groups/Proxy/InstanceMethods.html +256 -0
- data/doc/Sequencescape/Api/Resource/Groups/Proxy.html +177 -0
- data/doc/Sequencescape/Api/Resource/Groups.html +270 -0
- data/doc/Sequencescape/Api/Resource/InstanceMethods.html +344 -0
- data/doc/Sequencescape/Api/Resource/Json/ClassMethods.html +243 -0
- data/doc/Sequencescape/Api/Resource/Json/CoercionHandler.html +279 -0
- data/doc/Sequencescape/Api/Resource/Json.html +405 -0
- data/doc/Sequencescape/Api/Resource/Modifications.html +295 -0
- data/doc/Sequencescape/Api/Resource.html +436 -0
- data/doc/Sequencescape/Api/ResourceInvalid.html +289 -0
- data/doc/Sequencescape/Api/ResourceModelProxy.html +444 -0
- data/doc/Sequencescape/Api/Version1.html +218 -0
- data/doc/Sequencescape/Api/Version2.html +222 -0
- data/doc/Sequencescape/Api.html +704 -0
- data/doc/Sequencescape/Asset.html +262 -0
- data/doc/Sequencescape/AssetAudit.html +258 -0
- data/doc/Sequencescape/AssetGroup.html +258 -0
- data/doc/Sequencescape/BaitLibraryLayout.html +258 -0
- data/doc/Sequencescape/BarcodePrinter.html +258 -0
- data/doc/Sequencescape/BarcodedAsset.html +293 -0
- data/doc/Sequencescape/Batch.html +327 -0
- data/doc/Sequencescape/Behaviour/Barcoded.html +195 -0
- data/doc/Sequencescape/Behaviour/Labeled.html +189 -0
- data/doc/Sequencescape/Behaviour/Qced/QcFile.html +244 -0
- data/doc/Sequencescape/Behaviour/Qced.html +199 -0
- data/doc/Sequencescape/Behaviour/Receptacle/Aliquot.html +258 -0
- data/doc/Sequencescape/Behaviour/Receptacle.html +195 -0
- data/doc/Sequencescape/Behaviour/StateDriven.html +205 -0
- data/doc/Sequencescape/Behaviour.html +130 -0
- data/doc/Sequencescape/BulkTransfer.html +258 -0
- data/doc/Sequencescape/Comment.html +258 -0
- data/doc/Sequencescape/Lane.html +282 -0
- data/doc/Sequencescape/LibraryEvent.html +258 -0
- data/doc/Sequencescape/LibraryTube.html +322 -0
- data/doc/Sequencescape/Lot.html +258 -0
- data/doc/Sequencescape/LotType/LotCreator.html +182 -0
- data/doc/Sequencescape/LotType.html +268 -0
- data/doc/Sequencescape/MultiplexedLibraryTube.html +326 -0
- data/doc/Sequencescape/Order.html +338 -0
- data/doc/Sequencescape/OrderTemplate/OrderCreator.html +182 -0
- data/doc/Sequencescape/OrderTemplate.html +268 -0
- data/doc/Sequencescape/Pipeline.html +258 -0
- data/doc/Sequencescape/Plate/CommentsCreation.html +184 -0
- data/doc/Sequencescape/Plate/CurrentVolumeSubstraction.html +236 -0
- data/doc/Sequencescape/Plate/Pooling.html +249 -0
- data/doc/Sequencescape/Plate/WellStructure.html +313 -0
- data/doc/Sequencescape/Plate.html +446 -0
- data/doc/Sequencescape/PlateConversion.html +258 -0
- data/doc/Sequencescape/PlateCreation.html +258 -0
- data/doc/Sequencescape/PlatePurpose/PlateCreation.html +186 -0
- data/doc/Sequencescape/PlatePurpose.html +268 -0
- data/doc/Sequencescape/PlateTemplate.html +282 -0
- data/doc/Sequencescape/PooledPlateCreation.html +258 -0
- data/doc/Sequencescape/Project.html +258 -0
- data/doc/Sequencescape/QcDecision.html +258 -0
- data/doc/Sequencescape/QcFile.html +327 -0
- data/doc/Sequencescape/Qcable.html +258 -0
- data/doc/Sequencescape/QcableCreator.html +258 -0
- data/doc/Sequencescape/Request.html +258 -0
- data/doc/Sequencescape/Robot.html +258 -0
- data/doc/Sequencescape/Sample.html +258 -0
- data/doc/Sequencescape/SampleTube.html +318 -0
- data/doc/Sequencescape/Search/BaseHandler.html +234 -0
- data/doc/Sequencescape/Search/MultipleResultHandler.html +276 -0
- data/doc/Sequencescape/Search/SingleResultHandler.html +303 -0
- data/doc/Sequencescape/Search.html +431 -0
- data/doc/Sequencescape/SpecificTubeCreation.html +258 -0
- data/doc/Sequencescape/Stamp.html +258 -0
- data/doc/Sequencescape/StateChange.html +258 -0
- data/doc/Sequencescape/Study.html +258 -0
- data/doc/Sequencescape/Submission.html +258 -0
- data/doc/Sequencescape/SubmissionPool.html +258 -0
- data/doc/Sequencescape/Tag/Group.html +219 -0
- data/doc/Sequencescape/Tag.html +149 -0
- data/doc/Sequencescape/Tag2Layout.html +258 -0
- data/doc/Sequencescape/Tag2LayoutTemplate.html +258 -0
- data/doc/Sequencescape/TagGroup.html +258 -0
- data/doc/Sequencescape/TagLayout.html +258 -0
- data/doc/Sequencescape/TagLayoutTemplate.html +258 -0
- data/doc/Sequencescape/Template.html +258 -0
- data/doc/Sequencescape/Transfer.html +258 -0
- data/doc/Sequencescape/TransferTemplate.html +258 -0
- data/doc/Sequencescape/Tube.html +319 -0
- data/doc/Sequencescape/TubeCreation.html +258 -0
- data/doc/Sequencescape/TubeFromTubeCreation.html +258 -0
- data/doc/Sequencescape/TubePurpose/TubeCreation.html +186 -0
- data/doc/Sequencescape/TubePurpose.html +268 -0
- data/doc/Sequencescape/User.html +258 -0
- data/doc/Sequencescape/VolumeUpdate.html +258 -0
- data/doc/Sequencescape/Well.html +362 -0
- data/doc/Sequencescape.html +121 -0
- data/doc/_index.html +1248 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +481 -0
- data/doc/file.README.html +76 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +76 -0
- data/doc/js/app.js +243 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1411 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/sequencescape/asset.rb +10 -0
- data/lib/sequencescape/asset_audit.rb +7 -0
- data/lib/sequencescape/asset_group.rb +9 -0
- data/lib/sequencescape/bait_library.rb +14 -0
- data/lib/sequencescape/bait_library_layout.rb +9 -0
- data/lib/sequencescape/barcode_printer.rb +13 -0
- data/lib/sequencescape/barcoded_asset.rb +12 -0
- data/lib/sequencescape/batch.rb +24 -0
- data/lib/sequencescape/behaviour/barcoded.rb +15 -0
- data/lib/sequencescape/behaviour/labeled.rb +14 -0
- data/lib/sequencescape/behaviour/qced.rb +31 -0
- data/lib/sequencescape/behaviour/receptacle.rb +21 -0
- data/lib/sequencescape/behaviour/state_driven.rb +19 -0
- data/lib/sequencescape/bulk_transfer.rb +8 -0
- data/lib/sequencescape/comment.rb +7 -0
- data/lib/sequencescape/custom_metadatum_collection.rb +8 -0
- data/lib/sequencescape/lane.rb +8 -0
- data/lib/sequencescape/library_event.rb +5 -0
- data/lib/sequencescape/library_tube.rb +7 -0
- data/lib/sequencescape/locale/en.yml +190 -0
- data/lib/sequencescape/lot.rb +11 -0
- data/lib/sequencescape/lot_type.rb +20 -0
- data/lib/sequencescape/multiplexed_library_tube.rb +6 -0
- data/lib/sequencescape/order.rb +13 -0
- data/lib/sequencescape/order_template.rb +19 -0
- data/lib/sequencescape/pipeline.rb +10 -0
- data/lib/sequencescape/plate/pooling.rb +23 -0
- data/lib/sequencescape/plate/well_structure.rb +27 -0
- data/lib/sequencescape/plate.rb +71 -0
- data/lib/sequencescape/plate_conversion.rb +8 -0
- data/lib/sequencescape/plate_creation.rb +8 -0
- data/lib/sequencescape/plate_purpose.rb +24 -0
- data/lib/sequencescape/plate_template.rb +13 -0
- data/lib/sequencescape/pooled_plate_creation.rb +8 -0
- data/lib/sequencescape/project.rb +11 -0
- data/lib/sequencescape/qc_decision.rb +9 -0
- data/lib/sequencescape/qc_file.rb +14 -0
- data/lib/sequencescape/qcable.rb +17 -0
- data/lib/sequencescape/qcable_creator.rb +13 -0
- data/lib/sequencescape/request.rb +16 -0
- data/lib/sequencescape/robot.rb +5 -0
- data/lib/sequencescape/sample.rb +51 -0
- data/lib/sequencescape/sample_tube.rb +7 -0
- data/lib/sequencescape/search.rb +80 -0
- data/lib/sequencescape/specific_tube_creation.rb +8 -0
- data/lib/sequencescape/stamp.rb +9 -0
- data/lib/sequencescape/state_change.rb +11 -0
- data/lib/sequencescape/study.rb +14 -0
- data/lib/sequencescape/submission.rb +16 -0
- data/lib/sequencescape/submission_pool.rb +7 -0
- data/lib/sequencescape/tag.rb +14 -0
- data/lib/sequencescape/tag2_layout.rb +10 -0
- data/lib/sequencescape/tag2_layout_template.rb +9 -0
- data/lib/sequencescape/tag_group.rb +4 -0
- data/lib/sequencescape/tag_layout.rb +10 -0
- data/lib/sequencescape/tag_layout_template.rb +15 -0
- data/lib/sequencescape/template.rb +6 -0
- data/lib/sequencescape/transfer.rb +9 -0
- data/lib/sequencescape/transfer_request.rb +12 -0
- data/lib/sequencescape/transfer_request_collection.rb +8 -0
- data/lib/sequencescape/transfer_template.rb +9 -0
- data/lib/sequencescape/tube.rb +26 -0
- data/lib/sequencescape/tube_creation.rb +8 -0
- data/lib/sequencescape/tube_from_tube_creation.rb +8 -0
- data/lib/sequencescape/tube_purpose.rb +24 -0
- data/lib/sequencescape/user.rb +13 -0
- data/lib/sequencescape/volume_update.rb +6 -0
- data/lib/sequencescape/well.rb +19 -0
- data/lib/sequencescape/work_completion.rb +10 -0
- data/lib/sequencescape-api/actions.rb +69 -0
- data/lib/sequencescape-api/associations/base/instance_methods.rb +57 -0
- data/lib/sequencescape-api/associations/base.rb +15 -0
- data/lib/sequencescape-api/associations/belongs_to.rb +127 -0
- data/lib/sequencescape-api/associations/has_many/json.rb +10 -0
- data/lib/sequencescape-api/associations/has_many/validation.rb +37 -0
- data/lib/sequencescape-api/associations/has_many.rb +123 -0
- data/lib/sequencescape-api/associations.rb +112 -0
- data/lib/sequencescape-api/capabilities.rb +11 -0
- data/lib/sequencescape-api/composition.rb +37 -0
- data/lib/sequencescape-api/connection_factory/actions.rb +154 -0
- data/lib/sequencescape-api/connection_factory/helpers.rb +9 -0
- data/lib/sequencescape-api/connection_factory.rb +40 -0
- data/lib/sequencescape-api/core.rb +63 -0
- data/lib/sequencescape-api/core_ext/array.rb +7 -0
- data/lib/sequencescape-api/core_ext/hash.rb +18 -0
- data/lib/sequencescape-api/core_ext.rb +2 -0
- data/lib/sequencescape-api/error_handling.rb +42 -0
- data/lib/sequencescape-api/errors.rb +38 -0
- data/lib/sequencescape-api/finder_methods.rb +184 -0
- data/lib/sequencescape-api/locale/en.yml +7 -0
- data/lib/sequencescape-api/rails.rb +88 -0
- data/lib/sequencescape-api/resource/active_model.rb +17 -0
- data/lib/sequencescape-api/resource/attribute_groups.rb +94 -0
- data/lib/sequencescape-api/resource/attributes.rb +87 -0
- data/lib/sequencescape-api/resource/instance_methods.rb +24 -0
- data/lib/sequencescape-api/resource/json.rb +114 -0
- data/lib/sequencescape-api/resource/modifications.rb +111 -0
- data/lib/sequencescape-api/resource.rb +47 -0
- data/lib/sequencescape-api/resource_model_proxy.rb +44 -0
- data/lib/sequencescape-api/version.rb +5 -0
- data/lib/sequencescape-api.rb +16 -0
- data/lib/sequencescape.rb +81 -0
- data/sequencescape-api.gemspec +32 -0
- data/spec/sequencescape-api/associations_spec.rb +95 -0
- data/spec/sequencescape-api/contracts/belongs-to-association.txt +14 -0
- data/spec/sequencescape-api/contracts/client-fails-authentication.txt +6 -0
- data/spec/sequencescape-api/contracts/create-invalid-resource.txt +10 -0
- data/spec/sequencescape-api/contracts/create-model-c-has-many-inline-nested.txt +10 -0
- data/spec/sequencescape-api/contracts/create-model-c-has-many-inline.txt +10 -0
- data/spec/sequencescape-api/contracts/create-model-c-has-many.txt +10 -0
- data/spec/sequencescape-api/contracts/create-model-c.txt +11 -0
- data/spec/sequencescape-api/contracts/create-via-has-many.txt +9 -0
- data/spec/sequencescape-api/contracts/model-a-instance.txt +21 -0
- data/spec/sequencescape-api/contracts/model-b-instance.txt +38 -0
- data/spec/sequencescape-api/contracts/model-c-instance-created.txt +17 -0
- data/spec/sequencescape-api/contracts/model-c-instance-updated.txt +17 -0
- data/spec/sequencescape-api/contracts/model-c-instance.txt +28 -0
- data/spec/sequencescape-api/contracts/model-c-invalid-attribute.txt +8 -0
- data/spec/sequencescape-api/contracts/resource-not-found.txt +6 -0
- data/spec/sequencescape-api/contracts/results-page-1.txt +17 -0
- data/spec/sequencescape-api/contracts/results-page-2.txt +18 -0
- data/spec/sequencescape-api/contracts/results-page-3.txt +17 -0
- data/spec/sequencescape-api/contracts/retrieve-belongs-to-association.txt +3 -0
- data/spec/sequencescape-api/contracts/retrieve-model.txt +4 -0
- data/spec/sequencescape-api/contracts/retrieve-results-page-1.txt +3 -0
- data/spec/sequencescape-api/contracts/retrieve-results-page-2.txt +3 -0
- data/spec/sequencescape-api/contracts/retrieve-results-page-3.txt +3 -0
- data/spec/sequencescape-api/contracts/retrieve-root-with-an-authorised-client.txt +5 -0
- data/spec/sequencescape-api/contracts/retrieve-root-with-an-unauthorised-client.txt +4 -0
- data/spec/sequencescape-api/contracts/retrieve-unauthorised-model-a-list.txt +4 -0
- data/spec/sequencescape-api/contracts/retrieve-unauthorised-model-b-list.txt +4 -0
- data/spec/sequencescape-api/contracts/retrieve-unauthorised-model-c-list.txt +4 -0
- data/spec/sequencescape-api/contracts/root-response-for-authorised-client.txt +20 -0
- data/spec/sequencescape-api/contracts/root-response-for-unauthorised-client.txt +28 -0
- data/spec/sequencescape-api/contracts/unauthorised-model-a-list.txt +15 -0
- data/spec/sequencescape-api/contracts/unauthorised-model-b-list.txt +14 -0
- data/spec/sequencescape-api/contracts/unauthorised-model-c-list.txt +15 -0
- data/spec/sequencescape-api/contracts/update-invalid-resource.txt +10 -0
- data/spec/sequencescape-api/contracts/update-model-c.txt +11 -0
- data/spec/sequencescape-api/finding_methods_spec.rb +34 -0
- data/spec/sequencescape-api/modifications_spec.rb +169 -0
- data/spec/sequencescape-api/root_spec.rb +58 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/support/contract_helper.rb +112 -0
- data/spec/support/namespaces.rb +67 -0
- data/spec/support/shared_examples.rb +12 -0
- metadata +540 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"model_b": {
|
6
|
+
"actions": {
|
7
|
+
"read": "http://localhost:3000/UUID"
|
8
|
+
},
|
9
|
+
|
10
|
+
"uuid": "UUID",
|
11
|
+
|
12
|
+
"model_a": {
|
13
|
+
"actions": {
|
14
|
+
"read": "http://localhost:3000/BELONGS_TO_UUID"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"model_by_simple_name": {
|
18
|
+
"actions": {
|
19
|
+
"read": "http://localhost:3000/BELONGS_TO_UUID"
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"model_by_full_name": {
|
23
|
+
"actions": {
|
24
|
+
"read": "http://localhost:3000/BELONGS_TO_UUID"
|
25
|
+
}
|
26
|
+
},
|
27
|
+
"model_with_early_data": {
|
28
|
+
"actions": {
|
29
|
+
"read": "http://localhost:3000/BELONGS_TO_UUID"
|
30
|
+
},
|
31
|
+
"name": "early data from JSON",
|
32
|
+
"group": {
|
33
|
+
"data": "early group data from JSON"
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
HTTP/1.1 201 Created
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"model_c": {
|
6
|
+
"actions": {
|
7
|
+
"read": "http://localhost:3000/UUID",
|
8
|
+
"update": "http://localhost:3000/UUID"
|
9
|
+
},
|
10
|
+
|
11
|
+
"uuid": "UUID",
|
12
|
+
"changes_during_update": "set during create",
|
13
|
+
"remains_same_during_update": "and this was too"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"model_c": {
|
6
|
+
"actions": {
|
7
|
+
"read": "http://localhost:3000/UUID",
|
8
|
+
"update": "http://localhost:3000/UUID"
|
9
|
+
},
|
10
|
+
|
11
|
+
"uuid": "UUID",
|
12
|
+
"changes_during_update": "changed",
|
13
|
+
"remains_same_during_update": "stays the same",
|
14
|
+
"write_only": "has been set"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"model_c": {
|
6
|
+
"actions": {
|
7
|
+
"read": "http://localhost:3000/UUID",
|
8
|
+
"update": "http://localhost:3000/UUID"
|
9
|
+
},
|
10
|
+
|
11
|
+
"uuid": "UUID",
|
12
|
+
"changes_during_update": "from JSON",
|
13
|
+
"remains_same_during_update": "from JSON",
|
14
|
+
|
15
|
+
"model_bs": [
|
16
|
+
{
|
17
|
+
|
18
|
+
},
|
19
|
+
{
|
20
|
+
|
21
|
+
},
|
22
|
+
{
|
23
|
+
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"actions": {
|
6
|
+
"first": "http://localhost:3000/pages/1",
|
7
|
+
"next": "http://localhost:3000/pages/2",
|
8
|
+
"last": "http://localhost:3000/pages/3",
|
9
|
+
"read": "http://localhost:3000/pages/1"
|
10
|
+
},
|
11
|
+
"size": 3,
|
12
|
+
"model_as": [
|
13
|
+
{
|
14
|
+
|
15
|
+
}
|
16
|
+
]
|
17
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"actions": {
|
6
|
+
"first": "http://localhost:3000/pages/1",
|
7
|
+
"previous": "http://localhost:3000/pages/1",
|
8
|
+
"next": "http://localhost:3000/pages/3",
|
9
|
+
"last": "http://localhost:3000/pages/3",
|
10
|
+
"read": "http://localhost:3000/pages/2"
|
11
|
+
},
|
12
|
+
"size": 3,
|
13
|
+
"model_as": [
|
14
|
+
{
|
15
|
+
|
16
|
+
}
|
17
|
+
]
|
18
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"actions": {
|
6
|
+
"first": "http://localhost:3000/pages/1",
|
7
|
+
"previous": "http://localhost:3000/pages/2",
|
8
|
+
"last": "http://localhost:3000/pages/3",
|
9
|
+
"read": "http://localhost:3000/pages/3"
|
10
|
+
},
|
11
|
+
"size": 3,
|
12
|
+
"model_as": [
|
13
|
+
{
|
14
|
+
|
15
|
+
}
|
16
|
+
]
|
17
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"revision": 2,
|
6
|
+
|
7
|
+
"model_c": {
|
8
|
+
"actions": {
|
9
|
+
"read": "http://localhost:3000/model_c/read",
|
10
|
+
"create": "http://localhost:3000/model_c/create",
|
11
|
+
"update": "http://localhost:3000/model_c/update",
|
12
|
+
"foo": "http://localhost:3000/model_c/bar"
|
13
|
+
}
|
14
|
+
},
|
15
|
+
"model_d": {
|
16
|
+
"actions": {
|
17
|
+
"read": "http://localhost:3000/model_d"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"revision": 2,
|
6
|
+
|
7
|
+
"model_a": {
|
8
|
+
"actions": {
|
9
|
+
"read": "http://localhost:3000/model_a"
|
10
|
+
}
|
11
|
+
},
|
12
|
+
"model_b": {
|
13
|
+
"actions": {
|
14
|
+
"read": "http://localhost:3000/model_b"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"model_c": {
|
18
|
+
"actions": {
|
19
|
+
"read": "http://localhost:3000/model_c",
|
20
|
+
"create": "http://localhost:3000/model_c/create"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
"pages": {
|
24
|
+
"actions": {
|
25
|
+
"read": "http://localhost:3000/pages/1"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"actions": {
|
6
|
+
"read": "http://localhost:3000/model_a/1",
|
7
|
+
"first": "http://localhost:3000/model_a/1",
|
8
|
+
"next": "http://localhost:3000/model_a/2",
|
9
|
+
"last": "http://localhost:3000/model_a/3"
|
10
|
+
},
|
11
|
+
"size": 0,
|
12
|
+
"model_a": [
|
13
|
+
|
14
|
+
]
|
15
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/json
|
3
|
+
|
4
|
+
{
|
5
|
+
"actions": {
|
6
|
+
"read": "http://localhost:3000/model_c/1",
|
7
|
+
"first": "http://localhost:3000/model_c/1",
|
8
|
+
"next": "http://localhost:3000/model_c/2",
|
9
|
+
"last": "http://localhost:3000/model_c/3"
|
10
|
+
},
|
11
|
+
"size": 0,
|
12
|
+
"model_c": [
|
13
|
+
|
14
|
+
]
|
15
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Finding a resource instance' do
|
4
|
+
is_working_as_an_unauthorised_client
|
5
|
+
|
6
|
+
subject { api.model_c.find('UUID') }
|
7
|
+
|
8
|
+
context 'when it is not found' do
|
9
|
+
stub_request_from('retrieve-model') { response('resource-not-found') }
|
10
|
+
|
11
|
+
it 'raises an exception' do
|
12
|
+
lambda { subject }.should raise_error(Sequencescape::Api::ResourceNotFound)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when it is found' do
|
17
|
+
stub_request_from('retrieve-model') { response('model-c-instance') }
|
18
|
+
|
19
|
+
its(:changes_during_update) { should == 'from JSON' }
|
20
|
+
its(:remains_same_during_update) { should == 'from JSON' }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'Finding resource instances' do
|
25
|
+
is_working_as_an_unauthorised_client
|
26
|
+
|
27
|
+
stub_request_and_response('results-page-1')
|
28
|
+
stub_request_and_response('results-page-2')
|
29
|
+
stub_request_and_response('results-page-3')
|
30
|
+
|
31
|
+
subject { api.page.all }
|
32
|
+
|
33
|
+
it_behaves_like 'a paged result'
|
34
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples_for 'errors on both client and server' do |action, request_contract|
|
4
|
+
context 'may be invalid on the client side' do
|
5
|
+
it 'raises an error' do
|
6
|
+
lambda do
|
7
|
+
target.__send__(action, :attribute_validated_at_client => 'please error')
|
8
|
+
end.should raise_error(Sequencescape::Api::ResourceInvalid)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'includes the error on the field' do
|
12
|
+
begin
|
13
|
+
target.__send__(action, :attribute_validated_at_client => 'please error')
|
14
|
+
rescue Sequencescape::Api::ResourceInvalid => exception
|
15
|
+
exception.resource.errors[:attribute_validated_at_client].should == [ 'cannot be set' ]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'may be invalid on the server side' do
|
21
|
+
stub_request_from(request_contract) { response('model-c-invalid-attribute') }
|
22
|
+
|
23
|
+
it 'raises an error' do
|
24
|
+
lambda do
|
25
|
+
target.__send__(action, :attribute_validated_at_server => 'please error')
|
26
|
+
end.should raise_error(Sequencescape::Api::ResourceInvalid)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'includes the error on the field' do
|
30
|
+
begin
|
31
|
+
target.__send__(action, :attribute_validated_at_server => 'please error')
|
32
|
+
rescue Sequencescape::Api::ResourceInvalid => exception
|
33
|
+
exception.resource.errors[:attribute_validated_at_server].should == [ 'cannot be set' ]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'Creating a resource' do
|
40
|
+
is_working_as_an_unauthorised_client
|
41
|
+
|
42
|
+
let(:target) { api.model_c }
|
43
|
+
|
44
|
+
context do
|
45
|
+
it_behaves_like 'errors on both client and server', :create!, 'create-invalid-resource'
|
46
|
+
end
|
47
|
+
|
48
|
+
context do
|
49
|
+
stub_request_from('create-model-c') { response('model-c-instance-created') }
|
50
|
+
|
51
|
+
subject do
|
52
|
+
target.create!(:changes_during_update => 'sent from client', :remains_same_during_update => 'from JSON')
|
53
|
+
end
|
54
|
+
|
55
|
+
its(:changes_during_update) { should == 'set during create' }
|
56
|
+
its(:remains_same_during_update) { should == 'and this was too' }
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'with its associations' do
|
60
|
+
context 'belongs_to' do
|
61
|
+
it 'takes an object and converts it to UUID'
|
62
|
+
end
|
63
|
+
context 'has_many disposition: :inline' do
|
64
|
+
stub_request_from('create-model-c-has-many-inline') { response('model-c-instance-created') }
|
65
|
+
|
66
|
+
it 'takes an array of objects and converts them to UUID'
|
67
|
+
it 'assumes an array of strings are UUIDs' do
|
68
|
+
target.create!(:model_bs => ['model-b-uuids'])
|
69
|
+
end
|
70
|
+
it 'raises if not given an enumerable'
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'has_many disposition: :inline nested' do
|
74
|
+
stub_request_from('create-model-c-has-many-inline-nested') { response('model-c-instance-created') }
|
75
|
+
|
76
|
+
it 'takes an array of objects and converts them to UUID'
|
77
|
+
it 'assumes an array of strings are UUIDs' do
|
78
|
+
target.create!(:model_bs => [{ "test_attribute" => "test_value" }])
|
79
|
+
end
|
80
|
+
it 'raises if not given an enumerable'
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'has_many' do
|
84
|
+
stub_request_from('create-model-c-has-many') { response('model-c-instance-created') }
|
85
|
+
|
86
|
+
it 'takes an array of objects and converts them to UUID'
|
87
|
+
it 'assumes an array of strings are UUIDs' do
|
88
|
+
target.create!(:model_as => ['model-a-uuids'])
|
89
|
+
end
|
90
|
+
it 'raises if not given an enumerable'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'through an association' do
|
95
|
+
context 'has_many' do
|
96
|
+
it 'ensures that the instance becomes part of the association'
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe 'Updating a resource' do
|
102
|
+
is_working_as_an_unauthorised_client
|
103
|
+
|
104
|
+
stub_request_from('retrieve-model') { response('model-c-instance') }
|
105
|
+
let(:target) { api.model_c.find('UUID') }
|
106
|
+
|
107
|
+
context do
|
108
|
+
it_behaves_like 'errors on both client and server', :update_attributes!, 'update-invalid-resource'
|
109
|
+
end
|
110
|
+
|
111
|
+
shared_examples_for 'it is updating a resource' do
|
112
|
+
subject { target }
|
113
|
+
|
114
|
+
its(:changes_during_update) { should == 'changed' }
|
115
|
+
its(:remains_same_during_update) { should == 'stays the same' }
|
116
|
+
end
|
117
|
+
|
118
|
+
context '#update_attributes!' do
|
119
|
+
stub_request_from('update-model-c') { response('model-c-instance-updated') }
|
120
|
+
|
121
|
+
before(:each) do
|
122
|
+
subject.update_attributes!(
|
123
|
+
:changes_during_update => 'sent from client',
|
124
|
+
:remains_same_during_update => 'from JSON',
|
125
|
+
:write_only => 'has been set'
|
126
|
+
)
|
127
|
+
end
|
128
|
+
|
129
|
+
it_behaves_like 'it is updating a resource'
|
130
|
+
end
|
131
|
+
|
132
|
+
context '#save!' do
|
133
|
+
stub_request_from('update-model-c') { response('model-c-instance-updated') }
|
134
|
+
|
135
|
+
before(:each) do
|
136
|
+
subject.changes_during_update = 'sent from client'
|
137
|
+
subject.remains_same_during_update = 'from JSON'
|
138
|
+
subject.write_only = 'has been set'
|
139
|
+
subject.save!
|
140
|
+
end
|
141
|
+
|
142
|
+
it_behaves_like 'it is updating a resource'
|
143
|
+
end
|
144
|
+
|
145
|
+
context 'specifically its associations' do
|
146
|
+
context 'belongs_to' do
|
147
|
+
it 'takes an object and converts it to UUID'
|
148
|
+
end
|
149
|
+
context 'has_many' do
|
150
|
+
it 'takes an array of objects and converts them to UUID'
|
151
|
+
it 'assumes an array of strings are UUIDs'
|
152
|
+
it 'raises if not given an enumerable'
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe 'Updating a resource through an association' do
|
158
|
+
is_working_as_an_unauthorised_client
|
159
|
+
|
160
|
+
context 'belongs_to' do
|
161
|
+
it 'handles individual attribute changes'
|
162
|
+
it 'handles update_attributes!'
|
163
|
+
end
|
164
|
+
|
165
|
+
context 'has_many' do
|
166
|
+
it 'handles individual attribute changes'
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|