droplet_kit 3.9.0 → 3.13.1

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
2
  SHA256:
3
- metadata.gz: 817503da27fa13094693c81ceaf605dea004e28273aed2ae507cbcbc970d7cf5
4
- data.tar.gz: f7545ad2cc17947ae6ca310e27f9e6a435a78ef2273ea5c07fc13cc1fbe10ba7
3
+ metadata.gz: 42378c9ab960545fbf4331ae369a40dbc453d0df11f0ea001f4ce43eedc07bf5
4
+ data.tar.gz: 998a5544e12c192fcd41e2d16bd87690bdf09771d9eb34601a3e5e4793ccb8f0
5
5
  SHA512:
6
- metadata.gz: cd0d4889db87949b4758021de2e2d3dc0b8ed0606c03435f9269c48e1931eb01e1572413620390f06a790e7347d614dc2220d3faf811fef362b25947eecaa450
7
- data.tar.gz: a0a8a9acc022b86c904baad0b1591c9229591974883f272fa8f93c86994e22029f6d20f9440bc8c6e41e201ce3f50188f1545ea32d85a5f6717a8791a32b7190
6
+ metadata.gz: a18b104aa9c5929ed42fee92a4901773aab214a6df3161bba3d141e421a51e97b84beebbc63eed9d4309bcb27f699a1b73b0a472ba8cf64046e32e4d7da01174
7
+ data.tar.gz: 777d236b77ddde9f77d91259bf8f03a1ac09ffd2114471b6c44f4f300dfd10b16b579d77293c5340c8130253e66e82e10ec4686f4b5bd75243fe65099600c199
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # DropletKit
2
- [![Build Status](https://travis-ci.org/digitalocean/droplet_kit.svg?branch=master)](https://travis-ci.org/digitalocean/droplet_kit)
2
+ [![Build Status](https://github.com/digitalocean/droplet_kit/workflows/CI/badge.svg?branch=main)](https://github.com/digitalocean/droplet_kit/actions)
3
3
  [![Gem Version](https://badge.fury.io/rb/droplet_kit.svg)](https://badge.fury.io/rb/droplet_kit)
4
4
 
5
5
  DropletKit is the official [DigitalOcean V2 API](https://developers.digitalocean.com/v2/) client. It supports everything the API can do with a simple interface written in Ruby.
@@ -354,6 +354,17 @@ Image Actions Supported:
354
354
  * `client.image_actions.find(image_id: 123, id: 123455)`
355
355
  * `client.image_actions.transfer(image_id: 123, region: 'nyc3')`
356
356
 
357
+ ## Invoice resource
358
+
359
+ ```ruby
360
+ client = DropletKit::Client.new(access_token: 'TOKEN')
361
+ client.invoices #=> DropletKit::InvoiceResource
362
+ ```
363
+
364
+ Actions supported:
365
+
366
+ * `client.invoices.list()`
367
+ * `client.invoices.find(id:123)`
357
368
 
358
369
  ## Kubernetes Resource
359
370
 
@@ -506,7 +517,7 @@ Actions supported:
506
517
 
507
518
  ```ruby
508
519
  client = DropletKit::Client.new(access_token: 'TOKEN')
509
- client.balance #=> DropletKit::AccountResource
520
+ client.balance #=> DropletKit::BalanceResource
510
521
  ```
511
522
 
512
523
  Actions supported:
data/lib/droplet_kit.rb CHANGED
@@ -13,6 +13,7 @@ module DropletKit
13
13
  autoload :Droplet, 'droplet_kit/models/droplet'
14
14
  autoload :Region, 'droplet_kit/models/region'
15
15
  autoload :Image, 'droplet_kit/models/image'
16
+ autoload :Invoice, 'droplet_kit/models/invoice'
16
17
  autoload :Size, 'droplet_kit/models/size'
17
18
  autoload :NetworkHash, 'droplet_kit/models/network_hash'
18
19
  autoload :Network, 'droplet_kit/models/network'
@@ -75,6 +76,7 @@ module DropletKit
75
76
  autoload :DomainRecordResource, 'droplet_kit/resources/domain_record_resource'
76
77
  autoload :DropletActionResource, 'droplet_kit/resources/droplet_action_resource'
77
78
  autoload :ImageResource, 'droplet_kit/resources/image_resource'
79
+ autoload :InvoiceResource, 'droplet_kit/resources/invoice_resource'
78
80
  autoload :ImageActionResource, 'droplet_kit/resources/image_action_resource'
79
81
  autoload :SSHKeyResource, 'droplet_kit/resources/ssh_key_resource'
80
82
  autoload :RegionResource, 'droplet_kit/resources/region_resource'
@@ -115,6 +117,7 @@ module DropletKit
115
117
  autoload :DomainRecordMapping, 'droplet_kit/mappings/domain_record_mapping'
116
118
  autoload :DropletActionMapping, 'droplet_kit/mappings/droplet_action_mapping'
117
119
  autoload :ImageActionMapping, 'droplet_kit/mappings/image_action_mapping'
120
+ autoload :InvoiceMapping, 'droplet_kit/mappings/invoice_mapping'
118
121
  autoload :SSHKeyMapping, 'droplet_kit/mappings/ssh_key_mapping'
119
122
  autoload :AccountMapping, 'droplet_kit/mappings/account_mapping'
120
123
  autoload :BalanceMapping, 'droplet_kit/mappings/balance_mapping'
@@ -43,6 +43,7 @@ module DropletKit
43
43
  firewalls: FirewallResource,
44
44
  images: ImageResource,
45
45
  image_actions: ImageActionResource,
46
+ invoices: InvoiceResource,
46
47
  load_balancers: LoadBalancerResource,
47
48
  regions: RegionResource,
48
49
  sizes: SizeResource,
@@ -6,7 +6,7 @@ module DropletKit
6
6
  mapping DatabaseUser
7
7
  root_key singular: 'user', plural: 'users', scopes: [:read]
8
8
 
9
- property :name, scopes: [:read]
9
+ property :name, scopes: [:read, :create]
10
10
  property :role, scopes: [:read, :create]
11
11
  property :password, scopes: [:read, :create]
12
12
  end
@@ -0,0 +1,32 @@
1
+ module DropletKit
2
+ class InvoiceMapping
3
+ include Kartograph::DSL
4
+
5
+ kartograph do
6
+ mapping Invoice
7
+ root_key plural: 'invoices', scopes: [:read]
8
+ root_key plural: 'invoice_items', scopes: [:find]
9
+
10
+ scoped :read do
11
+ property :invoice_uuid
12
+ property :amount
13
+ property :invoice_period
14
+ end
15
+
16
+ scoped :find do
17
+ property :product
18
+ property :amount
19
+ property :resource_uuid
20
+ property :group_description
21
+ property :description
22
+ property :duration
23
+ property :duration_unit
24
+ property :start_time
25
+ property :end_time
26
+ property :project_name
27
+ property :category
28
+ end
29
+ end
30
+ end
31
+ end
32
+
@@ -12,6 +12,7 @@ module DropletKit
12
12
  property :status
13
13
  property :created_at
14
14
  property :region, include: RegionMapping
15
+ property :size
15
16
  property :vpc_uuid
16
17
  end
17
18
 
@@ -30,6 +31,7 @@ module DropletKit
30
31
 
31
32
  scoped :update, :create do
32
33
  property :region
34
+ property :size
33
35
  end
34
36
 
35
37
  scoped :create do
@@ -20,6 +20,7 @@ module DropletKit
20
20
  scoped :update, :patch do
21
21
  property :name
22
22
  property :description
23
+ property :default
23
24
  end
24
25
 
25
26
  scoped :create do
@@ -30,4 +31,4 @@ module DropletKit
30
31
  end
31
32
  end
32
33
  end
33
- end
34
+ end
@@ -0,0 +1,18 @@
1
+ module DropletKit
2
+ class Invoice < BaseModel
3
+ attribute :invoice_uuid
4
+ attribute :amount
5
+ attribute :invoice_period
6
+ attribute :product
7
+ attribute :resource_uuid
8
+ attribute :group_description
9
+ attribute :description
10
+ attribute :duration
11
+ attribute :duration_unit
12
+ attribute :start_time
13
+ attribute :end_time
14
+ attribute :project_name
15
+ attribute :category
16
+ end
17
+ end
18
+
@@ -8,6 +8,7 @@ module DropletKit
8
8
  attribute :created_at
9
9
  attribute :tag
10
10
  attribute :region
11
+ attribute :size
11
12
  attribute :redirect_http_to_https, Boolean, :default => false
12
13
  attribute :enable_proxy_protocol, Boolean, :default => false
13
14
  attribute :enable_backend_keepalive, Boolean, :default => false
@@ -4,7 +4,7 @@ module DropletKit
4
4
 
5
5
  resources do
6
6
  action :all, 'GET /v2/domains/:for_domain/records' do
7
- query_keys :per_page, :page
7
+ query_keys :per_page, :page, :name, :type
8
8
  handler(200) { |response| DomainRecordMapping.extract_collection(response.body, :read) }
9
9
  end
10
10
 
@@ -0,0 +1,15 @@
1
+ module DropletKit
2
+ class InvoiceResource < ResourceKit::Resource
3
+ include ErrorHandlingResourcable
4
+
5
+ resources do
6
+ action :list, 'GET /v2/customers/my/invoices' do
7
+ handler(200) { |response| InvoiceMapping.extract_collection(response.body, :read) }
8
+ end
9
+
10
+ action :find, 'GET v2/customers/my/invoices/:id' do
11
+ handler(200) { |response| InvoiceMapping.extract_collection(response.body, :find) }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -49,7 +49,7 @@ module DropletKit
49
49
  resources.to_a.map do |resource|
50
50
  if resource.is_a?(String) && DropletKit::BaseModel.valid_urn?(resource)
51
51
  resource
52
- elsif resource.try(:urn) && DropletKit::BaseModel.valid_urn?(resource.urn)
52
+ elsif resource.respond_to?(:urn) && resource.urn && DropletKit::BaseModel.valid_urn?(resource.urn)
53
53
  resource.urn
54
54
  else
55
55
  raise DropletKit::Error.new("cannot assign resource without valid urn: #{resource}")
@@ -1,3 +1,3 @@
1
1
  module DropletKit
2
- VERSION = "3.9.0"
2
+ VERSION = "3.13.1"
3
3
  end
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: 3.9.0
4
+ version: 3.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigitalOcean API Engineering team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-26 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -183,6 +183,7 @@ files:
183
183
  - lib/droplet_kit/mappings/forwarding_rule_mapping.rb
184
184
  - lib/droplet_kit/mappings/health_check_mapping.rb
185
185
  - lib/droplet_kit/mappings/image_mapping.rb
186
+ - lib/droplet_kit/mappings/invoice_mapping.rb
186
187
  - lib/droplet_kit/mappings/kernel_mapping.rb
187
188
  - lib/droplet_kit/mappings/kubernetes_cluster_mapping.rb
188
189
  - lib/droplet_kit/mappings/kubernetes_maintenance_policy_mapping.rb
@@ -242,6 +243,7 @@ files:
242
243
  - lib/droplet_kit/models/forwarding_rule.rb
243
244
  - lib/droplet_kit/models/health_check.rb
244
245
  - lib/droplet_kit/models/image.rb
246
+ - lib/droplet_kit/models/invoice.rb
245
247
  - lib/droplet_kit/models/kernel.rb
246
248
  - lib/droplet_kit/models/kubernetes_cluster.rb
247
249
  - lib/droplet_kit/models/kubernetes_maintenance_policy.rb
@@ -287,6 +289,7 @@ files:
287
289
  - lib/droplet_kit/resources/floating_ip_resource.rb
288
290
  - lib/droplet_kit/resources/image_action_resource.rb
289
291
  - lib/droplet_kit/resources/image_resource.rb
292
+ - lib/droplet_kit/resources/invoice_resource.rb
290
293
  - lib/droplet_kit/resources/kubernetes_cluster_resource.rb
291
294
  - lib/droplet_kit/resources/kubernetes_options_resource.rb
292
295
  - lib/droplet_kit/resources/load_balancer_resource.rb
@@ -321,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
324
  - !ruby/object:Gem::Version
322
325
  version: '0'
323
326
  requirements: []
324
- rubygems_version: 3.1.2
327
+ rubygems_version: 3.2.15
325
328
  signing_key:
326
329
  specification_version: 4
327
330
  summary: Droplet Kit is the official Ruby library for DigitalOcean's API