ibm-cloud-sdk 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/ibm/cloud/sdk/version.rb +1 -1
- data/lib/ibm/cloud/sdk/vpc/base_collection.rb +5 -6
- data/lib/ibm/cloud/sdk/vpc/base_mixins/has_child.rb +27 -0
- data/lib/ibm/cloud/sdk/vpc/instance/actions.rb +1 -1
- data/lib/ibm/cloud/sdk/vpc/instance/floating_ips.rb +1 -1
- data/lib/ibm/cloud/sdk/vpc/instance/network_interfaces.rb +1 -1
- data/lib/ibm/cloud/sdk/vpc/instance/volume_attachments.rb +1 -1
- data/lib/ibm/cloud/sdk/vpc/instances.rb +0 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e549ed1f265dba2b7b112602e225a10509451bffd348c7b04e0aefefe11a712
|
4
|
+
data.tar.gz: d342b3a1382bd87a650010b8558a1ce183eb9eb0f52081f8bfdbf4ec1ecf3bec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 689e9dd7cbb37ebea1f48f04fd587560d7b9ed39dd625e860845aee646d02fb0077ea233c2e3d88ed99a4051d22b52c485c5ebc186c190b44875ecef8c1a8862
|
7
|
+
data.tar.gz: 5ee30dca7e7d6e7a141e44094f2de5f181b50cbeecc941b81da8589e639d07bb0f39555e1fd8be1dca2263ad46dcbac7eb4c80b5164ef60b6d5005126aaf1887
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# typed: true
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require_relative('base_mixins/has_child')
|
5
|
+
|
4
6
|
module IBM
|
5
7
|
module Cloud
|
6
8
|
module SDK
|
@@ -21,6 +23,8 @@ module IBM
|
|
21
23
|
@array_key ||= array_key
|
22
24
|
@instance ||= child_class
|
23
25
|
|
26
|
+
(class << self; include ChildMixin; end) if child_class
|
27
|
+
|
24
28
|
super(parent, endpoint)
|
25
29
|
end
|
26
30
|
|
@@ -66,7 +70,7 @@ module IBM
|
|
66
70
|
# Get the total count if it exists in the response. Returns nil otherwise.
|
67
71
|
# @return [Integer] The total count reuturned by the server.
|
68
72
|
def count
|
69
|
-
fetch.json&.fetch(:total_count)
|
73
|
+
fetch.json&.fetch(:total_count, nil)
|
70
74
|
end
|
71
75
|
|
72
76
|
# A generic post method to create a resource on the collection.
|
@@ -77,11 +81,6 @@ module IBM
|
|
77
81
|
adhoc(method: 'post', payload_type: payload_type, payload: payload)
|
78
82
|
end
|
79
83
|
|
80
|
-
# Access a specific instance by either id or name depending on API.
|
81
|
-
def instance(id)
|
82
|
-
@instance.new(self, id)
|
83
|
-
end
|
84
|
-
|
85
84
|
private
|
86
85
|
|
87
86
|
# Create a generator that removes the need for pagination.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
# Access a specific instance by either id or name depending on API.
|
8
|
+
module ChildMixin
|
9
|
+
# Get an instance of the collection object.
|
10
|
+
# @param id [String] ID of Name to search on depending on API.
|
11
|
+
# @return [] The instance object.
|
12
|
+
def instance(id)
|
13
|
+
@instance.new(self, id)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Return the first_instance returned from a collection get.
|
17
|
+
def first_instance
|
18
|
+
result = params(limit: 1).all.first
|
19
|
+
return nil unless result
|
20
|
+
return nil unless result.key?(:id)
|
21
|
+
|
22
|
+
instance(result.fetch(:id))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibm-cloud-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IBM Cloud Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- lib/ibm/cloud/sdk/vpc.rb
|
70
70
|
- lib/ibm/cloud/sdk/vpc/base_collection.rb
|
71
71
|
- lib/ibm/cloud/sdk/vpc/base_instance.rb
|
72
|
+
- lib/ibm/cloud/sdk/vpc/base_mixins/has_child.rb
|
72
73
|
- lib/ibm/cloud/sdk/vpc/base_vpc.rb
|
73
74
|
- lib/ibm/cloud/sdk/vpc/cloud_sdk.rb
|
74
75
|
- lib/ibm/cloud/sdk/vpc/exceptions.rb
|
@@ -111,7 +112,7 @@ licenses:
|
|
111
112
|
- '"Apache-2.0"'
|
112
113
|
metadata:
|
113
114
|
homepage_uri: https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby
|
114
|
-
changelog_uri: https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby/blob/v0.1.
|
115
|
+
changelog_uri: https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby/blob/v0.1.8/CHANGELOG.md
|
115
116
|
post_install_message:
|
116
117
|
rdoc_options: []
|
117
118
|
require_paths:
|