droplet_kit 3.9.0 → 3.10.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
2
  SHA256:
3
- metadata.gz: 817503da27fa13094693c81ceaf605dea004e28273aed2ae507cbcbc970d7cf5
4
- data.tar.gz: f7545ad2cc17947ae6ca310e27f9e6a435a78ef2273ea5c07fc13cc1fbe10ba7
3
+ metadata.gz: b2033711a4b71e23fa0066e8918dbe57798bf597125a73daa19e899f47394b25
4
+ data.tar.gz: a6c6dfd3c811c9221d48d48f2f9f67476ef7967938fe690072687c0dce3933f6
5
5
  SHA512:
6
- metadata.gz: cd0d4889db87949b4758021de2e2d3dc0b8ed0606c03435f9269c48e1931eb01e1572413620390f06a790e7347d614dc2220d3faf811fef362b25947eecaa450
7
- data.tar.gz: a0a8a9acc022b86c904baad0b1591c9229591974883f272fa8f93c86994e22029f6d20f9440bc8c6e41e201ce3f50188f1545ea32d85a5f6717a8791a32b7190
6
+ metadata.gz: ba9269398ad9ee84c3f45fd6a9a9ed91d2779b3330208323a256c3cb1bb64a5d18a547fc95d93ede3d23f01f84084d788a95764e58c33b7e5a38ffa6bed205a9
7
+ data.tar.gz: de3b637394f1fc2b4fe76819796904cb00dea14e39769694d6e57a7ebff89a4bd165c78d3346e208e499c0b5afa7cc08f1537008c16cde07ce135816a177c29a
data/README.md CHANGED
@@ -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:
@@ -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,
@@ -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
+
@@ -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
+
@@ -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
@@ -1,3 +1,3 @@
1
1
  module DropletKit
2
- VERSION = "3.9.0"
2
+ VERSION = "3.10.0"
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.10.0
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: 2020-09-08 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