droplet_kit 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 84d6ad636a505caf049b0c9bcf8c38ff0aedda28
4
- data.tar.gz: a447e68783fce91d0eeaa1ecbefaf1ce1752ed57
2
+ SHA256:
3
+ metadata.gz: 2ec217312a19e55394c76f6f02a4e59b59525f0767405ea2e42fd5f24f5e09b8
4
+ data.tar.gz: 7c0d074571a6531486ae81dd7fc8f30a020bf60bc824a266a8f2701813f4539c
5
5
  SHA512:
6
- metadata.gz: d592ec69dd61e597c02a7ab9e737b42b58fa62189024ee745f27fa77d22e8fb99de448d7c09eae4d98325d813b7e5d2671ff669ef8b1b4721fb00b65f746afed
7
- data.tar.gz: 7ab6c9ae7ea96cabdc6b03be3abae4e4f559039bba48f4062dbce3f9763c153f9953b5dd77ce36a96783314622585c0fa3cae38e8514de2c8764609f1a2b46b6
6
+ metadata.gz: 1e7c4295594d705170819ced2305c2f92e20c2d497db5782c9aad227a055d2b72f910da9c84993f911dc02547a39115406a59aa359dfae489d7f1b2cc156b6e9
7
+ data.tar.gz: 9148f78a78f2dbef212fd71166feaa97d5a33fe4c46678529cd70593d1130f7810e00d650a5d860c1fbc31dec4dac050221bb735e9bed95f6db0e750273db7eb
@@ -1,3 +1,6 @@
1
+ ### Version 2.5.0
2
+ * Added ability to tag images and retrieving new fields for tagged resources.
3
+
1
4
  ### Version 2.4.0
2
5
  * Added CDN resource.
3
6
 
data/README.md CHANGED
@@ -359,8 +359,8 @@ Actions supported:
359
359
  * `client.tags.find(name: 'name')`
360
360
  * `client.tags.create(DropletKit::Tag.new(name: 'name'))`
361
361
  * `client.tags.delete(name: 'name')`
362
- * `client.tags.tag_resources(name: 'name', resources: [{ resource_id => 'droplet_id', resource_type: 'droplet' }])`
363
- * `client.tags.untag_resources(name 'name', resources: [{ resource_id => 'droplet_id', resource_type: 'droplet' }])`
362
+ * `client.tags.tag_resources(name: 'name', resources: [{ resource_id => 'droplet_id', resource_type: 'droplet' },{ resource_id => 'image_id', resource_type: 'image' }])`
363
+ * `client.tags.untag_resources(name 'name', resources: [{ resource_id => 'droplet_id', resource_type: 'droplet' },{ resource_id => 'image_id', resource_type: 'image' }])`
364
364
 
365
365
  ## Account resource
366
366
 
@@ -27,6 +27,7 @@ module DropletKit
27
27
  autoload :Tag, 'droplet_kit/models/tag'
28
28
  autoload :TaggedResources, 'droplet_kit/models/tagged_resources'
29
29
  autoload :TaggedDropletsResources, 'droplet_kit/models/tagged_droplets_resources'
30
+ autoload :TaggedImagesResources, 'droplet_kit/models/tagged_images_resources'
30
31
  autoload :Volume, 'droplet_kit/models/volume'
31
32
  autoload :LoadBalancer, 'droplet_kit/models/load_balancer'
32
33
  autoload :StickySession, 'droplet_kit/models/sticky_session'
@@ -85,6 +86,7 @@ module DropletKit
85
86
  autoload :TagMapping, 'droplet_kit/mappings/tag_mapping'
86
87
  autoload :TaggedResourcesMapping, 'droplet_kit/mappings/tagged_resources_mapping'
87
88
  autoload :TaggedDropletsResourcesMapping, 'droplet_kit/mappings/tagged_droplets_resources_mapping'
89
+ autoload :TaggedImagesResourcesMapping, 'droplet_kit/mappings/tagged_images_resources_mapping'
88
90
  autoload :VolumeMapping, 'droplet_kit/mappings/volume_mapping'
89
91
  autoload :LoadBalancerMapping, 'droplet_kit/mappings/load_balancer_mapping'
90
92
  autoload :StickySessionMapping, 'droplet_kit/mappings/sticky_session_mapping'
@@ -5,10 +5,11 @@ module DropletKit
5
5
  kartograph do
6
6
  mapping TaggedDropletsResources
7
7
 
8
- root_key plural: 'droplets', singular: 'tag', scopes: [:read]
8
+ root_key plural: 'droplets', singular: 'droplet', scopes: [:read]
9
9
 
10
10
  scoped :read do
11
11
  property :count
12
+ property :last_tagged_uri
12
13
  property :last_tagged, include: DropletMapping
13
14
  end
14
15
  end
@@ -0,0 +1,16 @@
1
+ module DropletKit
2
+ class TaggedImagesResourcesMapping
3
+ include Kartograph::DSL
4
+
5
+ kartograph do
6
+ mapping TaggedImagesResources
7
+
8
+ root_key plural: 'images', singular: 'image', scopes: [:read]
9
+
10
+ scoped :read do
11
+ property :count
12
+ property :last_tagged_uri
13
+ end
14
+ end
15
+ end
16
+ end
@@ -8,7 +8,10 @@ module DropletKit
8
8
  root_key plural: 'resources', singular: 'resource', scopes: [:read]
9
9
 
10
10
  scoped :read do
11
+ property :count
12
+ property :last_tagged_uri
11
13
  property :droplets, include: TaggedDropletsResourcesMapping
14
+ property :images, include: TaggedImagesResourcesMapping
12
15
  end
13
16
  end
14
17
  end
@@ -2,5 +2,6 @@ module DropletKit
2
2
  class TaggedDropletsResources < BaseModel
3
3
  attribute :count
4
4
  attribute :last_tagged
5
+ attribute :last_tagged_uri
5
6
  end
6
7
  end
@@ -0,0 +1,6 @@
1
+ module DropletKit
2
+ class TaggedImagesResources < BaseModel
3
+ attribute :count
4
+ attribute :last_tagged_uri
5
+ end
6
+ end
@@ -1,5 +1,8 @@
1
1
  module DropletKit
2
2
  class TaggedResources < BaseModel
3
+ attribute :count
4
+ attribute :last_tagged_uri
3
5
  attribute :droplets
6
+ attribute :images
4
7
  end
5
8
  end
@@ -1,3 +1,3 @@
1
1
  module DropletKit
2
- VERSION = "2.4.0"
2
+ VERSION = "2.5.0"
3
3
  end
@@ -3,18 +3,26 @@
3
3
  {
4
4
  "name": "testing-1",
5
5
  "resources": {
6
+ "count": 0,
6
7
  "droplets": {
7
8
  "count": 0,
8
9
  "last_tagged": null
10
+ },
11
+ "images": {
12
+ "count": 0
9
13
  }
10
14
  }
11
15
  },
12
16
  {
13
17
  "name": "testing-2",
14
18
  "resources": {
19
+ "count": 0,
15
20
  "droplets": {
16
21
  "count": 0,
17
22
  "last_tagged": null
23
+ },
24
+ "images": {
25
+ "count": 0
18
26
  }
19
27
  }
20
28
  }
@@ -2,9 +2,13 @@
2
2
  "tag": {
3
3
  "name": "testing-1",
4
4
  "resources": {
5
+ "count": 0,
5
6
  "droplets": {
6
7
  "count": 0,
7
8
  "last_tagged": null
9
+ },
10
+ "images": {
11
+ "count": 0
8
12
  }
9
13
  }
10
14
  }
@@ -2,8 +2,11 @@
2
2
  "tag": {
3
3
  "name": "testing-1",
4
4
  "resources": {
5
+ "count": 2,
6
+ "last_tagged_uri": "https://api.digitalocean.com/v2/droplets/1",
5
7
  "droplets": {
6
8
  "count": 1,
9
+ "last_tagged_uri": "https://api.digitalocean.com/v2/droplets/1",
7
10
  "last_tagged": {
8
11
  "id": 1,
9
12
  "name": "test.example.com",
@@ -82,10 +85,14 @@
82
85
 
83
86
  ],
84
87
  "tags": [
85
- "tag-1",
86
- "tag-2"
88
+ "testing-1",
89
+ "testing-2"
87
90
  ]
88
91
  }
92
+ },
93
+ "images": {
94
+ "count": 1,
95
+ "last_tagged_uri": "https://api.digitalocean.com/v2/images/146"
89
96
  }
90
97
  }
91
98
  }
@@ -47,9 +47,15 @@ describe DropletKit::TagResource do
47
47
 
48
48
  expect(tag).to be_kind_of(DropletKit::Tag)
49
49
  expect(tag).to match_tag_fixture
50
+ expect(tag.resources.count).to eq(2)
50
51
  expect(tag.resources.droplets.count).to eq(1)
51
52
  expect(tag.resources.droplets.last_tagged).to be_kind_of(DropletKit::Droplet)
52
53
  expect(tag.resources.droplets.last_tagged.id).to eq(1)
54
+ expect(tag.resources.droplets.last_tagged_uri).to eq('https://api.digitalocean.com/v2/droplets/1')
55
+
56
+ expect(tag.resources.images.count).to eq(1)
57
+ expect(tag.resources.images.attributes).to_not include(:last_tagged)
58
+ expect(tag.resources.images.last_tagged_uri).to eq('https://api.digitalocean.com/v2/images/146')
53
59
  end
54
60
  end
55
61
 
@@ -84,6 +90,10 @@ describe DropletKit::TagResource do
84
90
  {
85
91
  resource_id: '1',
86
92
  resource_type: "droplet"
93
+ },
94
+ {
95
+ resource_id: '146',
96
+ resource_type: "images"
87
97
  }
88
98
  ]
89
99
  }
@@ -105,6 +115,10 @@ describe DropletKit::TagResource do
105
115
  {
106
116
  resource_id: '1',
107
117
  resource_type: "droplet"
118
+ },
119
+ {
120
+ resource_id: '146',
121
+ resource_type: "images"
108
122
  }
109
123
  ]
110
124
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droplet_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Ross
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-02 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -232,6 +232,7 @@ files:
232
232
  - lib/droplet_kit/mappings/sticky_session_mapping.rb
233
233
  - lib/droplet_kit/mappings/tag_mapping.rb
234
234
  - lib/droplet_kit/mappings/tagged_droplets_resources_mapping.rb
235
+ - lib/droplet_kit/mappings/tagged_images_resources_mapping.rb
235
236
  - lib/droplet_kit/mappings/tagged_resources_mapping.rb
236
237
  - lib/droplet_kit/mappings/volume_mapping.rb
237
238
  - lib/droplet_kit/models/account.rb
@@ -265,6 +266,7 @@ files:
265
266
  - lib/droplet_kit/models/sticky_session.rb
266
267
  - lib/droplet_kit/models/tag.rb
267
268
  - lib/droplet_kit/models/tagged_droplets_resources.rb
269
+ - lib/droplet_kit/models/tagged_images_resources.rb
268
270
  - lib/droplet_kit/models/tagged_resources.rb
269
271
  - lib/droplet_kit/models/volume.rb
270
272
  - lib/droplet_kit/paginated_resource.rb
@@ -433,7 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
433
435
  version: '0'
434
436
  requirements: []
435
437
  rubyforge_project:
436
- rubygems_version: 2.6.11
438
+ rubygems_version: 2.7.6
437
439
  signing_key:
438
440
  specification_version: 4
439
441
  summary: Droplet Kit is the official Ruby library for DigitalOcean's API