droplet_kit 3.8.1 → 3.9.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: caa76a1ccea55362aad9aa3534b752aeeadb594585c9fa1142929e8cf5185272
4
- data.tar.gz: d0ff54091ac4d9eb6ca2c974ecc752393a4ec50496acc49b9baece5b77d7b2b8
3
+ metadata.gz: 817503da27fa13094693c81ceaf605dea004e28273aed2ae507cbcbc970d7cf5
4
+ data.tar.gz: f7545ad2cc17947ae6ca310e27f9e6a435a78ef2273ea5c07fc13cc1fbe10ba7
5
5
  SHA512:
6
- metadata.gz: 1519d7ca818603442b24b71c5d599c27c3c965733064fb03cd9e2313b76d635f66ee3bfbad9f7b64f9b0faa60f09e1e0003e983528cfd99af66b20b3667436c8
7
- data.tar.gz: 0e221aa8ee46304d20a65c7b033492d852a5e5cb2df21e8421491afa206736fb4458411973ec5c0f5c4dcfc5c3009b7e8c313435abc971e116d407b61c91ca7e
6
+ metadata.gz: cd0d4889db87949b4758021de2e2d3dc0b8ed0606c03435f9269c48e1931eb01e1572413620390f06a790e7347d614dc2220d3faf811fef362b25947eecaa450
7
+ data.tar.gz: a0a8a9acc022b86c904baad0b1591c9229591974883f272fa8f93c86994e22029f6d20f9440bc8c6e41e201ce3f50188f1545ea32d85a5f6717a8791a32b7190
data/README.md CHANGED
@@ -502,6 +502,16 @@ Actions supported:
502
502
 
503
503
  * `client.account.info()`
504
504
 
505
+ ## Balance resource
506
+
507
+ ```ruby
508
+ client = DropletKit::Client.new(access_token: 'TOKEN')
509
+ client.balance #=> DropletKit::AccountResource
510
+ ```
511
+
512
+ Actions supported:
513
+
514
+ * `client.balance.info()`
505
515
 
506
516
  ## Floating IP resource
507
517
 
@@ -24,6 +24,7 @@ module DropletKit
24
24
  autoload :SSHKey, 'droplet_kit/models/ssh_key'
25
25
  autoload :MetaInformation, 'droplet_kit/models/meta_information'
26
26
  autoload :Account, 'droplet_kit/models/account'
27
+ autoload :Balance, 'droplet_kit/models/balance'
27
28
  autoload :DropletUpgrade, 'droplet_kit/models/droplet_upgrade'
28
29
  autoload :FloatingIp, 'droplet_kit/models/floating_ip'
29
30
  autoload :Project, 'droplet_kit/models/project'
@@ -79,6 +80,7 @@ module DropletKit
79
80
  autoload :RegionResource, 'droplet_kit/resources/region_resource'
80
81
  autoload :SizeResource, 'droplet_kit/resources/size_resource'
81
82
  autoload :AccountResource, 'droplet_kit/resources/account_resource'
83
+ autoload :BalanceResource, 'droplet_kit/resources/balance_resource'
82
84
  autoload :DropletUpgradeResource, 'droplet_kit/resources/droplet_upgrade_resource'
83
85
  autoload :FloatingIpResource, 'droplet_kit/resources/floating_ip_resource'
84
86
  autoload :FloatingIpActionResource, 'droplet_kit/resources/floating_ip_action_resource'
@@ -115,6 +117,7 @@ module DropletKit
115
117
  autoload :ImageActionMapping, 'droplet_kit/mappings/image_action_mapping'
116
118
  autoload :SSHKeyMapping, 'droplet_kit/mappings/ssh_key_mapping'
117
119
  autoload :AccountMapping, 'droplet_kit/mappings/account_mapping'
120
+ autoload :BalanceMapping, 'droplet_kit/mappings/balance_mapping'
118
121
  autoload :DropletUpgradeMapping, 'droplet_kit/mappings/droplet_upgrade_mapping'
119
122
  autoload :FloatingIpMapping, 'droplet_kit/mappings/floating_ip_mapping'
120
123
  autoload :ProjectMapping, 'droplet_kit/mappings/project_mapping'
@@ -49,6 +49,7 @@ module DropletKit
49
49
  ssh_keys: SSHKeyResource,
50
50
  snapshots: SnapshotResource,
51
51
  account: AccountResource,
52
+ balance: BalanceResource,
52
53
  floating_ips: FloatingIpResource,
53
54
  floating_ip_actions: FloatingIpActionResource,
54
55
  tags: TagResource,
@@ -0,0 +1,14 @@
1
+ module DropletKit
2
+ class BalanceMapping
3
+ include Kartograph::DSL
4
+
5
+ kartograph do
6
+ mapping Balance
7
+ property :month_to_date_balance, scopes: [:read]
8
+ property :account_balance, scopes: [:read]
9
+ property :month_to_date_usage, scopes: [:read]
10
+ property :generated_at, scopes: [:read]
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ module DropletKit
2
+ class Balance < BaseModel
3
+ attribute :month_to_date_balance
4
+ attribute :account_balance
5
+ attribute :month_to_date_usage
6
+ attribute :generated_at
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module DropletKit
2
+ class BalanceResource < ResourceKit::Resource
3
+ include ErrorHandlingResourcable
4
+
5
+ resources do
6
+ default_handler(:ok) {|r| BalanceMapping.extract_single(r.body, :read) }
7
+ get '/v2/customers/my/balance' => :info
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module DropletKit
2
- VERSION = "3.8.1"
2
+ VERSION = "3.9.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.8.1
4
+ version: 3.9.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-03 00:00:00.000000000 Z
11
+ date: 2020-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -150,6 +150,7 @@ files:
150
150
  - lib/droplet_kit/error_handling_resourcable.rb
151
151
  - lib/droplet_kit/mappings/account_mapping.rb
152
152
  - lib/droplet_kit/mappings/action_mapping.rb
153
+ - lib/droplet_kit/mappings/balance_mapping.rb
153
154
  - lib/droplet_kit/mappings/cdn_mapping.rb
154
155
  - lib/droplet_kit/mappings/certificate_mapping.rb
155
156
  - lib/droplet_kit/mappings/container_registry_mapping.rb
@@ -208,6 +209,7 @@ files:
208
209
  - lib/droplet_kit/mappings/vpc_member_mapping.rb
209
210
  - lib/droplet_kit/models/account.rb
210
211
  - lib/droplet_kit/models/action.rb
212
+ - lib/droplet_kit/models/balance.rb
211
213
  - lib/droplet_kit/models/base_model.rb
212
214
  - lib/droplet_kit/models/cdn.rb
213
215
  - lib/droplet_kit/models/certificate.rb
@@ -269,6 +271,7 @@ files:
269
271
  - lib/droplet_kit/paginated_resource.rb
270
272
  - lib/droplet_kit/resources/account_resource.rb
271
273
  - lib/droplet_kit/resources/action_resource.rb
274
+ - lib/droplet_kit/resources/balance_resource.rb
272
275
  - lib/droplet_kit/resources/cdn_resource.rb
273
276
  - lib/droplet_kit/resources/certificate_resource.rb
274
277
  - lib/droplet_kit/resources/container_registry_repository_resource.rb
@@ -318,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
321
  - !ruby/object:Gem::Version
319
322
  version: '0'
320
323
  requirements: []
321
- rubygems_version: 3.0.8
324
+ rubygems_version: 3.1.2
322
325
  signing_key:
323
326
  specification_version: 4
324
327
  summary: Droplet Kit is the official Ruby library for DigitalOcean's API