bio-basespace-sdk 0.1.2

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.

Potentially problematic release.


This version of bio-basespace-sdk might be problematic. Click here for more details.

Files changed (65) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +11 -0
  4. data/Gemfile +16 -0
  5. data/License.txt +275 -0
  6. data/README.md +671 -0
  7. data/Rakefile +54 -0
  8. data/VERSION +1 -0
  9. data/examples/0_app_triggering.rb +135 -0
  10. data/examples/1_authentication.rb +156 -0
  11. data/examples/2_browsing.rb +84 -0
  12. data/examples/3_accessing_files.rb +129 -0
  13. data/examples/4_app_result_upload.rb +102 -0
  14. data/examples/5_purchasing.rb +119 -0
  15. data/lib/basespace.rb +126 -0
  16. data/lib/basespace/api/api_client.rb +313 -0
  17. data/lib/basespace/api/base_api.rb +242 -0
  18. data/lib/basespace/api/basespace_api.rb +789 -0
  19. data/lib/basespace/api/basespace_error.rb +80 -0
  20. data/lib/basespace/api/billing_api.rb +115 -0
  21. data/lib/basespace/model.rb +78 -0
  22. data/lib/basespace/model/app_result.rb +158 -0
  23. data/lib/basespace/model/app_result_response.rb +40 -0
  24. data/lib/basespace/model/app_session.rb +99 -0
  25. data/lib/basespace/model/app_session_compact.rb +43 -0
  26. data/lib/basespace/model/app_session_launch_object.rb +58 -0
  27. data/lib/basespace/model/app_session_response.rb +41 -0
  28. data/lib/basespace/model/application.rb +47 -0
  29. data/lib/basespace/model/application_compact.rb +44 -0
  30. data/lib/basespace/model/basespace_model.rb +60 -0
  31. data/lib/basespace/model/coverage.rb +48 -0
  32. data/lib/basespace/model/coverage_meta_response.rb +40 -0
  33. data/lib/basespace/model/coverage_metadata.rb +43 -0
  34. data/lib/basespace/model/coverage_response.rb +40 -0
  35. data/lib/basespace/model/file.rb +172 -0
  36. data/lib/basespace/model/file_response.rb +40 -0
  37. data/lib/basespace/model/genome_response.rb +40 -0
  38. data/lib/basespace/model/genome_v1.rb +56 -0
  39. data/lib/basespace/model/list_response.rb +53 -0
  40. data/lib/basespace/model/multipart_upload.rb +288 -0
  41. data/lib/basespace/model/product.rb +50 -0
  42. data/lib/basespace/model/project.rb +103 -0
  43. data/lib/basespace/model/project_response.rb +40 -0
  44. data/lib/basespace/model/purchase.rb +89 -0
  45. data/lib/basespace/model/purchase_response.rb +39 -0
  46. data/lib/basespace/model/purchased_product.rb +56 -0
  47. data/lib/basespace/model/query_parameters.rb +86 -0
  48. data/lib/basespace/model/query_parameters_purchased_product.rb +67 -0
  49. data/lib/basespace/model/refund_purchase_response.rb +40 -0
  50. data/lib/basespace/model/resource_list.rb +48 -0
  51. data/lib/basespace/model/response_status.rb +42 -0
  52. data/lib/basespace/model/run_compact.rb +55 -0
  53. data/lib/basespace/model/sample.rb +127 -0
  54. data/lib/basespace/model/sample_response.rb +40 -0
  55. data/lib/basespace/model/user.rb +80 -0
  56. data/lib/basespace/model/user_compact.rb +45 -0
  57. data/lib/basespace/model/user_response.rb +40 -0
  58. data/lib/basespace/model/variant.rb +57 -0
  59. data/lib/basespace/model/variant_header.rb +44 -0
  60. data/lib/basespace/model/variant_info.rb +48 -0
  61. data/lib/basespace/model/variants_header_response.rb +40 -0
  62. data/spec/basespaceapi_spec.rb +26 -0
  63. data/spec/basespaceerror_spec.rb +87 -0
  64. data/spec/basespacemodel_spec.rb +57 -0
  65. metadata +239 -0
@@ -0,0 +1,89 @@
1
+ # Copyright 2013 Toshiaki Katayama, Joachim Baran
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require 'basespace/api/basespace_error'
15
+ require 'basespace/model'
16
+
17
+ module Bio
18
+ module BaseSpace
19
+
20
+ # Represents a BaseSpace Purchase object.
21
+ class Purchase < Model
22
+
23
+ # Create a new Purchase instance.
24
+ def initialize
25
+ @swagger_types = {
26
+ 'Id' => 'str',
27
+ 'Status' => 'str', # PENDING, CANCELLED, ERRORED, COMPLETED
28
+ 'RefundStatus' => 'str', # NOTREFUNDED, REFUNDED
29
+ 'DateCreated' => 'datetime',
30
+ 'DateUpdated' => 'datetime',
31
+ 'InvoiceNumber' => 'str',
32
+ 'Amount' => 'str',
33
+ 'AmountOfTax' => 'str',
34
+ 'AmountTotal' => 'str',
35
+ 'Products' => 'list<Product>',
36
+ 'PurchaseType' => 'str',
37
+ 'AppSession' => 'AppSessionCompact',
38
+ 'User' => 'UserCompact',
39
+ 'Application' => 'ApplicationCompact',
40
+ 'HrefPurchaseDialog' => 'str', # new purchases only
41
+ 'RefundSecret' => 'str', # new purchases only
42
+ 'ExceptionMessage' => 'str', # errors only
43
+ 'ExceptionStackTrace' => 'str', # errors only
44
+ 'DateRefunded' => 'datetime', # refunds only
45
+ 'UserRefundedBy' => 'str', # refunds only
46
+ 'RefundComment' => 'str', # refunds only
47
+ }
48
+ @attributes = {
49
+ 'Id' => nil,
50
+ 'Status' => nil,
51
+ 'RefundStatus' => nil,
52
+ 'DateCreated' => nil,
53
+ 'DateUpdated' => nil,
54
+ 'InvoiceNumber' => nil,
55
+ 'Amount' => nil,
56
+ 'AmountOfTax' => nil,
57
+ 'AmountTotal' => nil,
58
+ 'Products' => nil,
59
+ 'PurchaseType' => nil,
60
+ 'AppSession' => nil,
61
+ 'User' => nil,
62
+ 'Application' => nil,
63
+ 'HrefPurchaseDialog' => nil,
64
+ 'RefundSecret' => nil,
65
+ 'ExceptionMessage' => nil,
66
+ 'ExceptionStackTrace' => nil,
67
+ 'DateRefunded' => nil,
68
+ 'UserRefundedBy' => nil,
69
+ 'RefundComment' => nil,
70
+ }
71
+ end
72
+
73
+ # Return the purchase ID.
74
+ def to_s
75
+ return @id.to_s
76
+ end
77
+
78
+ # Test if the Purchase instance has been initialized.
79
+ #
80
+ # Throws ModelNotInitializedError, if the object has not been populated yet.
81
+ def is_init
82
+ raise ModelNotInitializedError.new('The project model has not been initialized yet') unless get_attr('Id')
83
+ end
84
+
85
+ end
86
+
87
+ end # module BaseSpace
88
+ end # module Bio
89
+
@@ -0,0 +1,39 @@
1
+ # Copyright 2013 Toshiaki Katayama, Joachim Baran
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require 'basespace/model'
15
+
16
+ module Bio
17
+ module BaseSpace
18
+
19
+ # A Purchase response.
20
+ class PurchaseResponse < Model
21
+
22
+ # Create a new PurchaseResponse instance.
23
+ def initialize
24
+ @swagger_types = {
25
+ 'ResponseStatus' => 'ResponseStatus',
26
+ 'Response' => 'Purchase',
27
+ 'Notifications' => 'list<Str>',
28
+ }
29
+ @attributes = {
30
+ 'ResponseStatus' => nil, # ResponseStatus
31
+ 'Response' => nil, # Purchase
32
+ 'Notifications' => nil, # list<Str>
33
+ }
34
+ end
35
+
36
+ end
37
+
38
+ end # module BaseSpace
39
+ end # module Bio
@@ -0,0 +1,56 @@
1
+ # Copyright 2013 Toshiaki Katayama, Joachim Baran
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require 'basespace/model'
15
+
16
+ module Bio
17
+ module BaseSpace
18
+
19
+ # Purchased product model.
20
+ class PurchasedProduct < Model
21
+
22
+ # Create a new PurchasedProduct instance.
23
+ def initialize
24
+ @swagger_types = {
25
+ 'PurchaseId' => 'str',
26
+ 'DatePurchased' => 'datetime',
27
+ 'Id' => 'str',
28
+ 'Name' => 'str',
29
+ 'Price' => 'str',
30
+ 'Quantity' => 'str',
31
+ 'PersistenceStatus' => 'str',
32
+ 'Tags' => 'list<str>', # only if provided as a query parameter
33
+ 'ProductIds' => 'list<str>', # only if provided as a query parameter
34
+ }
35
+ @attributes = {
36
+ 'PurchaseId' => nil,
37
+ 'DatePurchased' => nil,
38
+ 'Id' => nil,
39
+ 'Name' => nil,
40
+ 'Price' => nil,
41
+ 'Quantity' => nil,
42
+ 'PersistenceStatus' => nil,
43
+ 'Tags' => nil,
44
+ 'ProductIds' => nil,
45
+ }
46
+ end
47
+
48
+ # Return the name of the purchased product.
49
+ def to_s
50
+ return get_attr('Name').to_s
51
+ end
52
+
53
+ end
54
+
55
+ end # module BaseSpace
56
+ end # module Bio
@@ -0,0 +1,86 @@
1
+ # Copyright 2013 Toshiaki Katayama, Joachim Baran
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require 'basespace/api/basespace_error'
15
+
16
+ module Bio
17
+ module BaseSpace
18
+
19
+ # The QueryParameters class can be passed as an optional arguments for
20
+ # a specific sorting of list-responses (such as lists of Sample, AppResult,
21
+ # or Variant).
22
+ class QueryParameters
23
+ attr_accessor :passed, :required
24
+
25
+ # not very strict parameters testing
26
+ LEGAL = {
27
+ 'Statuses' => [],
28
+ 'SortBy' => ['Id', 'Name', 'DateCreated', 'Path', 'Position'],
29
+ 'Format' => ['txt'],
30
+ 'Extensions' => [],
31
+ 'Offset' => [],
32
+ 'Limit' => [],
33
+ 'SortDir' => ['Asc', 'Desc'],
34
+ 'Name' => [],
35
+ }
36
+
37
+ # Create a new QueryParameters instance.
38
+ #
39
+ # +pars+:: Query parameters.
40
+ # +required+:: List of required query parameters.
41
+ def initialize(pars = {}, required = ['SortBy', 'Offset', 'Limit', 'SortDir'])
42
+ @passed = {
43
+ 'SortBy' => 'Id',
44
+ 'Offset' => '0', # [TODO] .to_i?
45
+ 'Limit' => '100', # [TODO] .to_i?
46
+ 'SortDir' => 'Asc',
47
+ }
48
+ pars.each do |k, v|
49
+ @passed[k] = v
50
+ end
51
+ @required = required
52
+ end
53
+
54
+ # Returns a string representation of all query parameters contained in the object.
55
+ def to_s
56
+ return @passed.to_s
57
+ end
58
+
59
+ # Returns a debugging string representation of the object.
60
+ def to_str
61
+ return self.inspect
62
+ end
63
+
64
+ # Returns all query parameters.
65
+ def get_parameter_dict
66
+ return @passed
67
+ end
68
+
69
+ # Check the validity of all query parameters.
70
+ #
71
+ # Throws UndefinedParameterError if a required parameters is not present.
72
+ def validate
73
+ @required.each do |p|
74
+ raise UndefinedParameterError.new(p) unless @passed[p]
75
+ end
76
+ @passed.each do |p, v|
77
+ raise UnknownParameterError.new(p) unless LEGAL[p]
78
+ raise IllegalParameterError.new(p, LEGAL[p]) if (LEGAL[p].length > 0 and ! LEGAL[p].include?(@passed[p]))
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ end # module BaseSpace
85
+ end # module Bio
86
+
@@ -0,0 +1,67 @@
1
+ # Copyright 2013 Toshiaki Katayama, Joachim Baran
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require 'basespace/api/basespace_error'
15
+
16
+ module Bio
17
+ module BaseSpace
18
+
19
+ # This class can be passed as an optional argument for a filtering getUserProducts list response.
20
+ class QueryParametersPurchasedProduct
21
+ attr_accessor :passed
22
+
23
+ LEGAL = {
24
+ 'Tags' => [],
25
+ 'ProductIds' => [],
26
+ }
27
+
28
+ # Create a new QueryParametersPurchasedProduct instance.
29
+ #
30
+ # +pars+:: Query parameters used for list filtering.
31
+ def initialize(pars = {})
32
+ @passed = {}
33
+ pars.each do |k, v|
34
+ @passed[k] = v
35
+ end
36
+ validate
37
+ end
38
+
39
+ # Return a string representation of all query parameters.
40
+ def to_s
41
+ return @passed.to_s
42
+ end
43
+
44
+ # Return debugging information of the object.
45
+ def to_str
46
+ return self.inspect
47
+ end
48
+
49
+ # Return the query parameters.
50
+ def get_parameter_dict
51
+ return @passed
52
+ end
53
+
54
+ # Check if the query parameters are valid.
55
+ #
56
+ # Throws UnknownParameterError for illegal parameters.
57
+ def validate
58
+ @passed.each do |k, v|
59
+ raise UnknownParameterError.new(k) unless LEGAL.has_key?(k)
60
+ end
61
+ end
62
+
63
+ end
64
+
65
+ end # module BaseSpace
66
+ end # module Bio
67
+
@@ -0,0 +1,40 @@
1
+ # Copyright 2013 Toshiaki Katayama, Joachim Baran
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require 'basespace/model'
15
+
16
+ module Bio
17
+ module BaseSpace
18
+
19
+ # Response of a refund purchase.
20
+ class RefundPurchaseResponse < Model
21
+
22
+ # Create a new RefundPurchaseResponse instance.
23
+ def initialize
24
+ @swagger_types = {
25
+ 'ResponseStatus' => 'ResponseStatus',
26
+ 'Response' => 'Purchase',
27
+ 'Notifications' => 'list<Str>',
28
+ }
29
+ @attributes = {
30
+ 'ResponseStatus' => nil, # ResponseStatus
31
+ 'Response' => nil, # Purchase
32
+ 'Notifications' => nil, # list<Str>
33
+ }
34
+ end
35
+
36
+ end
37
+
38
+ end # module BaseSpace
39
+ end # module Bio
40
+
@@ -0,0 +1,48 @@
1
+ # Copyright 2013 Toshiaki Katayama, Joachim Baran
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require 'basespace/model'
15
+
16
+ module Bio
17
+ module BaseSpace
18
+
19
+ # Resource list model.
20
+ class ResourceList < Model
21
+
22
+ # Create a new ResourceList instance.
23
+ def initialize
24
+ @swagger_types = {
25
+ 'Items' => 'list<Str>',
26
+ 'DisplayedCount' => 'int',
27
+ 'SortDir' => 'str',
28
+ 'TotalCount' => 'int',
29
+ 'Offset' => 'int',
30
+ 'SortBy' => 'str',
31
+ 'Limit' => 'int',
32
+ }
33
+ @attributes = {
34
+ 'Items' => nil, # list<Str>
35
+ 'DisplayedCount' => nil, # int
36
+ 'SortDir' => nil, # str
37
+ 'TotalCount' => nil, # int
38
+ 'Offset' => nil, # int
39
+ 'SortBy' => nil, # str
40
+ 'Limit' => nil, # int
41
+ }
42
+ end
43
+
44
+ end
45
+
46
+ end # module BaseSpace
47
+ end # module Bio
48
+
@@ -0,0 +1,42 @@
1
+ # Copyright 2013 Toshiaki Katayama, Joachim Baran
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require 'basespace/model'
15
+
16
+ module Bio
17
+ module BaseSpace
18
+
19
+ # Response status model.
20
+ class ResponseStatus < Model
21
+
22
+ # Create a new ResponseStatus instance.
23
+ def initialize
24
+ @swagger_types = {
25
+ 'Message' => 'str',
26
+ 'Errors' => 'list<Str>',
27
+ 'ErrorCode' => 'str',
28
+ 'StackTrace' => 'str',
29
+ }
30
+ @attributes = {
31
+ 'Message' => nil, # str
32
+ 'Errors' => nil, # list<Str>
33
+ 'ErrorCode' => nil, # str
34
+ 'StackTrace' => nil, # str
35
+ }
36
+ end
37
+
38
+ end
39
+
40
+ end # module BaseSpace
41
+ end # module Bio
42
+