droplet_kit 3.17.0 → 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/droplet_kit/client.rb +1 -1
  3. data/lib/droplet_kit/error_handling_resourcable.rb +4 -3
  4. data/lib/droplet_kit/mappings/balance_mapping.rb +0 -1
  5. data/lib/droplet_kit/mappings/container_registry_mapping.rb +1 -1
  6. data/lib/droplet_kit/mappings/database_cluster_mapping.rb +8 -8
  7. data/lib/droplet_kit/mappings/database_connection_pool_mapping.rb +5 -5
  8. data/lib/droplet_kit/mappings/database_eviction_policy_mapping.rb +1 -1
  9. data/lib/droplet_kit/mappings/database_firewall_rule_mapping.rb +3 -3
  10. data/lib/droplet_kit/mappings/database_maintenance_window_mapping.rb +2 -2
  11. data/lib/droplet_kit/mappings/database_mapping.rb +1 -1
  12. data/lib/droplet_kit/mappings/database_sql_mode_mapping.rb +1 -1
  13. data/lib/droplet_kit/mappings/database_user_mapping.rb +3 -3
  14. data/lib/droplet_kit/mappings/database_user_reset_auth_mapping.rb +1 -1
  15. data/lib/droplet_kit/mappings/domain_mapping.rb +2 -2
  16. data/lib/droplet_kit/mappings/domain_record_mapping.rb +9 -9
  17. data/lib/droplet_kit/mappings/droplet_upgrade_mapping.rb +1 -1
  18. data/lib/droplet_kit/mappings/error_mapping.rb +1 -1
  19. data/lib/droplet_kit/mappings/firewall_inbound_rule_mapping.rb +1 -1
  20. data/lib/droplet_kit/mappings/firewall_outbound_rule_mapping.rb +1 -1
  21. data/lib/droplet_kit/mappings/floating_ip_mapping.rb +1 -1
  22. data/lib/droplet_kit/mappings/forwarding_rule_mapping.rb +1 -1
  23. data/lib/droplet_kit/mappings/image_mapping.rb +10 -10
  24. data/lib/droplet_kit/mappings/invoice_mapping.rb +0 -1
  25. data/lib/droplet_kit/mappings/kernel_mapping.rb +1 -1
  26. data/lib/droplet_kit/mappings/kubernetes_cluster_mapping.rb +9 -9
  27. data/lib/droplet_kit/mappings/kubernetes_node_mapping.rb +0 -1
  28. data/lib/droplet_kit/mappings/kubernetes_node_pool_mapping.rb +8 -9
  29. data/lib/droplet_kit/mappings/load_balancer_mapping.rb +1 -1
  30. data/lib/droplet_kit/mappings/network_detail_mapping.rb +1 -1
  31. data/lib/droplet_kit/mappings/network_mapping.rb +1 -1
  32. data/lib/droplet_kit/mappings/project_assignment_mapping.rb +1 -1
  33. data/lib/droplet_kit/mappings/project_mapping.rb +5 -5
  34. data/lib/droplet_kit/mappings/region_mapping.rb +1 -1
  35. data/lib/droplet_kit/mappings/reserved_ip_mapping.rb +1 -1
  36. data/lib/droplet_kit/mappings/size_mapping.rb +1 -0
  37. data/lib/droplet_kit/mappings/snapshot_mapping.rb +1 -1
  38. data/lib/droplet_kit/mappings/ssh_key_mapping.rb +1 -1
  39. data/lib/droplet_kit/mappings/volume_mapping.rb +5 -6
  40. data/lib/droplet_kit/mappings/vpc_member_mapping.rb +1 -1
  41. data/lib/droplet_kit/models/base_model.rb +3 -3
  42. data/lib/droplet_kit/models/container_registry_repository.rb +1 -1
  43. data/lib/droplet_kit/models/container_registry_repository_tag.rb +1 -1
  44. data/lib/droplet_kit/models/domain.rb +1 -1
  45. data/lib/droplet_kit/models/droplet.rb +6 -7
  46. data/lib/droplet_kit/models/invoice.rb +15 -16
  47. data/lib/droplet_kit/models/kernel.rb +1 -1
  48. data/lib/droplet_kit/models/kubernetes_cluster.rb +1 -1
  49. data/lib/droplet_kit/models/kubernetes_node.rb +1 -1
  50. data/lib/droplet_kit/models/kubernetes_node_pool.rb +1 -1
  51. data/lib/droplet_kit/models/load_balancer.rb +4 -4
  52. data/lib/droplet_kit/models/meta_information.rb +1 -1
  53. data/lib/droplet_kit/models/pagination_information.rb +1 -1
  54. data/lib/droplet_kit/models/project.rb +1 -1
  55. data/lib/droplet_kit/models/size.rb +1 -0
  56. data/lib/droplet_kit/models/snapshot.rb +1 -1
  57. data/lib/droplet_kit/models/ssh_key.rb +1 -1
  58. data/lib/droplet_kit/models/volume.rb +1 -1
  59. data/lib/droplet_kit/models/vpc.rb +1 -1
  60. data/lib/droplet_kit/models/vpc_member.rb +1 -1
  61. data/lib/droplet_kit/paginated_resource.rb +10 -10
  62. data/lib/droplet_kit/resources/account_resource.rb +1 -1
  63. data/lib/droplet_kit/resources/balance_resource.rb +1 -1
  64. data/lib/droplet_kit/resources/domain_record_resource.rb +2 -2
  65. data/lib/droplet_kit/resources/droplet_action_resource.rb +5 -5
  66. data/lib/droplet_kit/resources/firewall_resource.rb +3 -3
  67. data/lib/droplet_kit/resources/image_resource.rb +1 -1
  68. data/lib/droplet_kit/resources/kubernetes_cluster_resource.rb +3 -5
  69. data/lib/droplet_kit/resources/load_balancer_resource.rb +1 -1
  70. data/lib/droplet_kit/resources/project_resource.rb +1 -1
  71. data/lib/droplet_kit/resources/ssh_key_resource.rb +3 -3
  72. data/lib/droplet_kit/resources/volume_action_resource.rb +3 -3
  73. data/lib/droplet_kit/resources/vpc_resource.rb +5 -5
  74. data/lib/droplet_kit/utils.rb +9 -9
  75. data/lib/droplet_kit/version.rb +1 -1
  76. data/lib/droplet_kit.rb +2 -2
  77. data/lib/tasks/resource_doc.rake +8 -9
  78. metadata +93 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41268723b3dc385b7044425695730bfdd7f11852f790a3a0ef67d40b63dc5057
4
- data.tar.gz: d96fbf6b39c6d3536afdb3a3dd458cfa4bf5ffbdc758d023427d04eff85eef94
3
+ metadata.gz: a3e2b46c0716d69015a44fc025bd61dc48b1f554ff7757c6f58517a94879d5e6
4
+ data.tar.gz: 55198741a7f9c1ea42bfa3dbe99c6b0479839c744d2040c01245fd537577273a
5
5
  SHA512:
6
- metadata.gz: 6aa5da7401020dda27fafb3d7fa3844d089ade8c3e5b029cfe656fb1b802a798cc91f96cfe37c0204a73f26182952b8f004ef254cb599087ad6d3c590b4b1c2a
7
- data.tar.gz: bead9ef065aae464fd0d8c7f0b421c5e58d57af2026054d39ceaf2cef5286146bd4d2ba8ea6c9ce33a3e2a6391c4492edcef9270808ca3ba7e8b7808b2b1c3f3
6
+ metadata.gz: fcefea9fb76fb5d89181edc7044d39e1573e447dd2ad73acc0835b6c99f02559baa0412fc4f862a3c68a58299eb6fb712d140d6d5832546a5b319444e838420f
7
+ data.tar.gz: 98baa8e8ed6c35e86313b588ddb1e81b26e6d7ad5f563b67db377012ca79130868716ba0f633d3c1f822a8294b3116fe8831c72bcf534dc950c5525aba83fcc5
@@ -66,7 +66,7 @@ module DropletKit
66
66
  end
67
67
 
68
68
  def method_missing(name, *args, &block)
69
- if self.class.resources.keys.include?(name)
69
+ if self.class.resources.key?(name)
70
70
  resources[name] ||= self.class.resources[name].new(connection: connection)
71
71
  resources[name]
72
72
  else
@@ -4,16 +4,17 @@ module ErrorHandlingResourcable
4
4
  def self.included(base)
5
5
  base.send(:resources) do
6
6
  default_handler do |response|
7
- if (200...299).include?(response.status)
7
+ case response.status
8
+ when 200...299
8
9
  next
9
- elsif response.status == 429
10
+ when 429
10
11
  error = DropletKit::RateLimitReached.new("#{response.status}: #{response.body}")
11
12
  error.limit = response.headers['RateLimit-Limit']
12
13
  error.remaining = response.headers['RateLimit-Remaining']
13
14
  error.reset_at = response.headers['RateLimit-Reset']
14
15
  raise error
15
16
  else
16
- raise DropletKit::Error.new("#{response.status}: #{response.body}")
17
+ raise DropletKit::Error, "#{response.status}: #{response.body}"
17
18
  end
18
19
  end
19
20
  end
@@ -10,7 +10,6 @@ module DropletKit
10
10
  property :account_balance, scopes: [:read]
11
11
  property :month_to_date_usage, scopes: [:read]
12
12
  property :generated_at, scopes: [:read]
13
-
14
13
  end
15
14
  end
16
15
  end
@@ -7,7 +7,7 @@ module DropletKit
7
7
  mapping ContainerRegistry
8
8
  root_key singular: 'registry', scopes: [:read]
9
9
 
10
- property :name, scopes: [:read, :create]
10
+ property :name, scopes: %i[read create]
11
11
  end
12
12
  end
13
13
  end
@@ -9,22 +9,22 @@ module DropletKit
9
9
  root_key singular: 'database', plural: 'databases', scopes: [:read]
10
10
 
11
11
  property :id, scopes: [:read]
12
- property :name, scopes: [:read, :create, :restore]
13
- property :engine, scopes: [:read, :create, :restore]
14
- property :version, scopes: [:read, :create, :restore]
12
+ property :name, scopes: %i[read create restore]
13
+ property :engine, scopes: %i[read create restore]
14
+ property :version, scopes: %i[read create restore]
15
15
  property :connection, scopes: [:read], include: DatabaseConnectionMapping
16
16
  property :private_connection, scopes: [:read], include: DatabaseConnectionMapping
17
17
  property :users, plural: true, scopes: [:read], include: DatabaseUserMapping
18
18
  property :backup_restore, scopes: [:restore], include: DatabaseBackupRestoreMapping
19
- property :num_nodes, scopes: [:read, :create, :resize, :restore]
20
- property :size, scopes: [:read, :create, :resize, :restore]
19
+ property :num_nodes, scopes: %i[read create resize restore]
20
+ property :size, scopes: %i[read create resize restore]
21
21
  property :db_names, plural: true, scopes: [:read]
22
- property :region, scopes: [:read, :create, :migrate, :restore]
22
+ property :region, scopes: %i[read create migrate restore]
23
23
  property :status, scopes: [:read]
24
24
  property :maintenance_window, scopes: [:read], include: DatabaseMaintenanceWindowMapping
25
25
  property :created_at, scopes: [:read]
26
- property :private_network_uuid, scopes: [:read, :create]
27
- property :tags, plural: true, scopes: [:read, :create]
26
+ property :private_network_uuid, scopes: %i[read create]
27
+ property :tags, plural: true, scopes: %i[read create]
28
28
  end
29
29
  end
30
30
  end
@@ -8,11 +8,11 @@ module DropletKit
8
8
  mapping DatabaseConnectionPool
9
9
  root_key singular: 'pool', plural: 'pools', scopes: [:read]
10
10
 
11
- property :name, scopes: [:read, :create]
12
- property :mode, scopes: [:read, :create]
13
- property :size, scopes: [:read, :create]
14
- property :db, scopes: [:read, :create]
15
- property :user, scopes: [:read, :create]
11
+ property :name, scopes: %i[read create]
12
+ property :mode, scopes: %i[read create]
13
+ property :size, scopes: %i[read create]
14
+ property :db, scopes: %i[read create]
15
+ property :user, scopes: %i[read create]
16
16
  property :connection, scopes: [:read], include: DatabaseConnectionMapping
17
17
  end
18
18
  end
@@ -7,7 +7,7 @@ module DropletKit
7
7
  kartograph do
8
8
  mapping DatabaseEvictionPolicy
9
9
 
10
- property :eviction_policy, scopes: [:read, :update]
10
+ property :eviction_policy, scopes: %i[read update]
11
11
  end
12
12
  end
13
13
  end
@@ -6,10 +6,10 @@ module DropletKit
6
6
 
7
7
  kartograph do
8
8
  mapping DatabaseFirewallRule
9
- root_key plural: 'rules', scopes: [:read, :update]
9
+ root_key plural: 'rules', scopes: %i[read update]
10
10
 
11
- property :type, scopes: [:read, :update]
12
- property :value, scopes: [:read, :update]
11
+ property :type, scopes: %i[read update]
12
+ property :value, scopes: %i[read update]
13
13
  property :uuid, scopes: [:read]
14
14
  property :cluster_uuid, scopes: [:read]
15
15
  property :created_at, scopes: [:read]
@@ -8,8 +8,8 @@ module DropletKit
8
8
  mapping DatabaseMaintenanceWindow
9
9
  root_key singular: 'database_maintenance_window', plural: 'database_maintenance_windows', scopes: [:read]
10
10
 
11
- property :day, scopes: [:read, :update]
12
- property :hour, scopes: [:read, :update]
11
+ property :day, scopes: %i[read update]
12
+ property :hour, scopes: %i[read update]
13
13
  property :pending, scopes: [:read]
14
14
  property :description, scopes: [:read]
15
15
  end
@@ -8,7 +8,7 @@ module DropletKit
8
8
  mapping Database
9
9
  root_key singular: 'db', plural: 'dbs', scopes: [:read]
10
10
 
11
- property :name, scopes: [:read, :create]
11
+ property :name, scopes: %i[read create]
12
12
  end
13
13
  end
14
14
  end
@@ -7,7 +7,7 @@ module DropletKit
7
7
  kartograph do
8
8
  mapping DatabaseSQLMode
9
9
 
10
- property :sql_mode, scopes: [:read, :create]
10
+ property :sql_mode, scopes: %i[read create]
11
11
  end
12
12
  end
13
13
  end
@@ -8,9 +8,9 @@ module DropletKit
8
8
  mapping DatabaseUser
9
9
  root_key singular: 'user', plural: 'users', scopes: [:read]
10
10
 
11
- property :name, scopes: [:read, :create]
12
- property :role, scopes: [:read, :create]
13
- property :password, scopes: [:read, :create]
11
+ property :name, scopes: %i[read create]
12
+ property :role, scopes: %i[read create]
13
+ property :password, scopes: %i[read create]
14
14
  end
15
15
  end
16
16
  end
@@ -9,7 +9,7 @@ module DropletKit
9
9
  scoped :create do
10
10
  property :mysql_settings do
11
11
  mapping DatabaseUserMySQLSettings
12
- property :auth_plugin, scopes: [:create]
12
+ property :auth_plugin, scopes: [:create]
13
13
  end
14
14
  end
15
15
  end
@@ -8,10 +8,10 @@ module DropletKit
8
8
  mapping Domain
9
9
  root_key plural: 'domains', singular: 'domain', scopes: [:read]
10
10
 
11
- property :name, scopes: [:read, :create]
11
+ property :name, scopes: %i[read create]
12
12
  property :ttl, scopes: [:read]
13
13
  property :zone_file, scopes: [:read]
14
14
  property :ip_address, scopes: [:create]
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -9,15 +9,15 @@ module DropletKit
9
9
  root_key plural: 'domain_records', singular: 'domain_record', scopes: [:read]
10
10
 
11
11
  property :id, scopes: [:read]
12
- property :type, scopes: [:read, :create, :update]
13
- property :name, scopes: [:read, :create, :update]
14
- property :data, scopes: [:read, :create, :update]
15
- property :priority, scopes: [:read, :create, :update]
16
- property :port, scopes: [:read, :create, :update]
17
- property :ttl, scopes: [:read, :create, :update]
18
- property :weight, scopes: [:read, :create, :update]
19
- property :flags, scopes: [:read, :create, :update]
20
- property :tag, scopes: [:read, :create, :update]
12
+ property :type, scopes: %i[read create update]
13
+ property :name, scopes: %i[read create update]
14
+ property :data, scopes: %i[read create update]
15
+ property :priority, scopes: %i[read create update]
16
+ property :port, scopes: %i[read create update]
17
+ property :ttl, scopes: %i[read create update]
18
+ property :weight, scopes: %i[read create update]
19
+ property :flags, scopes: %i[read create update]
20
+ property :tag, scopes: %i[read create update]
21
21
  end
22
22
  end
23
23
  end
@@ -11,4 +11,4 @@ module DropletKit
11
11
  property :date_of_migration, scopes: [:read]
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -18,4 +18,4 @@ module DropletKit
18
18
  raise klass, error.message
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -6,7 +6,7 @@ module DropletKit
6
6
 
7
7
  kartograph do
8
8
  mapping FirewallInboundRule
9
- root_key plural: 'inbound_rules', scopes: [:read, :create, :update]
9
+ root_key plural: 'inbound_rules', scopes: %i[read create update]
10
10
 
11
11
  scoped :read, :create, :update do
12
12
  property :protocol
@@ -6,7 +6,7 @@ module DropletKit
6
6
 
7
7
  kartograph do
8
8
  mapping FirewallOutboundRule
9
- root_key plural: 'outbound_rules', scopes: [:read, :create, :update]
9
+ root_key plural: 'outbound_rules', scopes: %i[read create update]
10
10
 
11
11
  scoped :read, :create, :update do
12
12
  property :protocol
@@ -18,4 +18,4 @@ module DropletKit
18
18
  property :region, scopes: [:create]
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -5,7 +5,7 @@ module DropletKit
5
5
  include Kartograph::DSL
6
6
 
7
7
  kartograph do
8
- root_key plural: 'forwarding_rules', scopes: [:create, :update]
8
+ root_key plural: 'forwarding_rules', scopes: %i[create update]
9
9
  mapping ForwardingRule
10
10
 
11
11
  scoped :read, :create, :update do
@@ -10,17 +10,17 @@ module DropletKit
10
10
  root_key plural: 'snapshots', singular: 'snapshot', scopes: [:read_snapshot]
11
11
  root_key plural: 'backups', singular: 'backup', scopes: [:read_backup]
12
12
 
13
- property :id, scopes: [:read, :read_snapshot, :read_backup]
14
- property :name, scopes: [:read, :update, :read_snapshot, :read_backup]
15
- property :distribution, scopes: [:read, :read_snapshot, :read_backup]
16
- property :slug, scopes: [:read, :read_snapshot, :read_backup]
17
- property :public, scopes: [:read, :read_snapshot, :read_backup]
18
- property :regions, scopes: [:read, :read_snapshot, :read_backup]
19
- property :type, scopes: [:read, :read_snapshot, :read_backup]
13
+ property :id, scopes: %i[read read_snapshot read_backup]
14
+ property :name, scopes: %i[read update read_snapshot read_backup]
15
+ property :distribution, scopes: %i[read read_snapshot read_backup]
16
+ property :slug, scopes: %i[read read_snapshot read_backup]
17
+ property :public, scopes: %i[read read_snapshot read_backup]
18
+ property :regions, scopes: %i[read read_snapshot read_backup]
19
+ property :type, scopes: %i[read read_snapshot read_backup]
20
20
 
21
- property :min_disk_size, scopes: [:read, :read_snapshot, :read_backup]
22
- property :created_at, scopes: [:read, :read_snapshot, :read_backup]
23
- property :size_gigabytes, scopes: [:read, :read_snapshot, :read_backup]
21
+ property :min_disk_size, scopes: %i[read read_snapshot read_backup]
22
+ property :created_at, scopes: %i[read read_snapshot read_backup]
23
+ property :size_gigabytes, scopes: %i[read read_snapshot read_backup]
24
24
  end
25
25
  end
26
26
  end
@@ -31,4 +31,3 @@ module DropletKit
31
31
  end
32
32
  end
33
33
  end
34
-
@@ -13,4 +13,4 @@ module DropletKit
13
13
  property :version, scopes: [:read]
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -8,19 +8,19 @@ module DropletKit
8
8
  root_key plural: 'kubernetes_clusters', singular: 'kubernetes_cluster', scopes: [:read]
9
9
 
10
10
  property :id, scopes: [:read]
11
- property :name, scopes: [:read, :update, :create]
12
- property :region, scopes: [:read, :create]
13
- property :version, scopes: [:read, :create]
14
- property :auto_upgrade, scopes: [:read, :update, :create]
11
+ property :name, scopes: %i[read update create]
12
+ property :region, scopes: %i[read create]
13
+ property :version, scopes: %i[read create]
14
+ property :auto_upgrade, scopes: %i[read update create]
15
15
  property :cluster_subnet, scopes: [:read]
16
16
  property :service_subnet, scopes: [:read]
17
17
  property :ipv4, scopes: [:read]
18
18
  property :endpoint, scopes: [:read]
19
- property :tags, scopes: [:read, :update, :create]
20
- property :maintenance_policy, scopes: [:read, :update, :create]
21
- property :node_pools, scopes: [:read, :create]
22
- property :vpc_uuid, scopes: [:read, :create]
23
- property :ha, scopes: [:read, :create]
19
+ property :tags, scopes: %i[read update create]
20
+ property :maintenance_policy, scopes: %i[read update create]
21
+ property :node_pools, scopes: %i[read create]
22
+ property :vpc_uuid, scopes: %i[read create]
23
+ property :ha, scopes: %i[read create]
24
24
  end
25
25
  end
26
26
  end
@@ -14,4 +14,3 @@ module DropletKit
14
14
  end
15
15
  end
16
16
  end
17
-
@@ -20,18 +20,17 @@ module DropletKit
20
20
  property :nodes, plural: true, scopes: [:read], include: KubernetesNodeMapping
21
21
 
22
22
  # Create properties
23
- property :name, scopes: [:create, :update]
24
- property :size, scopes: [:create, :update]
25
- property :count, scopes: [:create, :update]
26
- property :tags, scopes: [:create, :update]
27
- property :labels, scopes: [:create, :update]
28
- property :auto_scale, scopes: [:create, :update]
29
- property :min_nodes, scopes: [:create, :update]
30
- property :max_nodes, scopes: [:create, :update]
23
+ property :name, scopes: %i[create update]
24
+ property :size, scopes: %i[create update]
25
+ property :count, scopes: %i[create update]
26
+ property :tags, scopes: %i[create update]
27
+ property :labels, scopes: %i[create update]
28
+ property :auto_scale, scopes: %i[create update]
29
+ property :min_nodes, scopes: %i[create update]
30
+ property :max_nodes, scopes: %i[create update]
31
31
 
32
32
  # recycle
33
33
  property :nodes, plural: true, scopes: [:recycle]
34
34
  end
35
35
  end
36
36
  end
37
-
@@ -33,7 +33,7 @@ module DropletKit
33
33
  property :disable_lets_encrypt_dns_records
34
34
  end
35
35
 
36
- scoped :update, :create do
36
+ scoped :update, :create do
37
37
  property :region
38
38
  property :size
39
39
  property :size_unit
@@ -14,4 +14,4 @@ module DropletKit
14
14
  property :cidr, scopes: [:read]
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -11,4 +11,4 @@ module DropletKit
11
11
  property :v6, plural: true, scopes: [:read], include: NetworkDetailMapping
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -8,7 +8,7 @@ module DropletKit
8
8
  mapping ProjectAssignment
9
9
  root_key plural: 'resources', singular: 'resource', scopes: [:read]
10
10
 
11
- property :urn, scopes: [:read, :create]
11
+ property :urn, scopes: %i[read create]
12
12
  property :assigned_at, scopes: [:read]
13
13
 
14
14
  property :links, scopes: [:read] do
@@ -12,11 +12,11 @@ module DropletKit
12
12
  property :owner_uuid, scopes: [:read]
13
13
  property :owner_id, scopes: [:read]
14
14
 
15
- property :name, scopes: [:read, :create, :update]
16
- property :description, scopes: [:read, :create, :update]
17
- property :purpose, scopes: [:read, :create, :update]
18
- property :environment, scopes: [:read, :create, :update]
19
- property :is_default, scopes: [:read, :create, :update]
15
+ property :name, scopes: %i[read create update]
16
+ property :description, scopes: %i[read create update]
17
+ property :purpose, scopes: %i[read create update]
18
+ property :environment, scopes: %i[read create update]
19
+ property :is_default, scopes: %i[read create update]
20
20
 
21
21
  property :created_at, scopes: [:read]
22
22
  property :updated_at, scopes: [:read]
@@ -15,4 +15,4 @@ module DropletKit
15
15
  property :features, scopes: [:read]
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -18,4 +18,4 @@ module DropletKit
18
18
  property :region, scopes: [:create]
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -17,6 +17,7 @@ module DropletKit
17
17
  property :price_hourly, scopes: [:read]
18
18
  property :regions, scopes: [:read]
19
19
  property :available, scopes: [:read]
20
+ property :description, scopes: [:read]
20
21
  end
21
22
  end
22
23
  end
@@ -18,4 +18,4 @@ module DropletKit
18
18
  property :size_gigabytes, scopes: [:read]
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -9,7 +9,7 @@ module DropletKit
9
9
  root_key singular: 'ssh_key', plural: 'ssh_keys', scopes: [:read]
10
10
 
11
11
  property :id, :fingerprint, :public_key, :name,
12
- scopes: [:read]
12
+ scopes: [:read]
13
13
 
14
14
  property :name, :public_key, scopes: [:create]
15
15
 
@@ -11,16 +11,15 @@ module DropletKit
11
11
  property :id, scopes: [:read]
12
12
  property :region, scopes: [:read], include: RegionMapping
13
13
  property :droplet_ids, scopes: [:read]
14
- property :name, scopes: [:read, :create]
15
- property :description, scopes: [:read, :create]
16
- property :size_gigabytes, scopes: [:read, :create]
14
+ property :name, scopes: %i[read create]
15
+ property :description, scopes: %i[read create]
16
+ property :size_gigabytes, scopes: %i[read create]
17
17
  property :created_at, scopes: [:read]
18
18
 
19
19
  property :region, scopes: [:create]
20
20
  property :snapshot_id, scopes: [:create]
21
- property :filesystem_type, scopes: [:read, :create]
22
- property :filesystem_label, scopes: [:read, :create]
21
+ property :filesystem_type, scopes: %i[read create]
22
+ property :filesystem_label, scopes: %i[read create]
23
23
  end
24
24
  end
25
25
  end
26
-
@@ -15,4 +15,4 @@ module DropletKit
15
15
  end
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -6,13 +6,13 @@ require 'droplet_kit/utils'
6
6
  module DropletKit
7
7
  class BaseModel
8
8
  DO_NAMESPACE = 'do'
9
- UNSUPPORTED_COLLECTIONS = ['space']
9
+ UNSUPPORTED_COLLECTIONS = ['space'].freeze
10
10
 
11
11
  include Virtus.model
12
12
  include Virtus::Equalizer.new(name || inspect)
13
13
 
14
14
  def inspect
15
- values = Hash[instance_variables.map { |name| [name, instance_variable_get(name)] } ]
15
+ values = instance_variables.map { |name| [name, instance_variable_get(name)] }.to_h
16
16
  "<#{self.class.name} #{values}>"
17
17
  end
18
18
 
@@ -26,7 +26,7 @@ module DropletKit
26
26
 
27
27
  def identifier
28
28
  identifier = attributes[:id] || attributes[:uuid] || attributes[:slug]
29
- raise DropletKit::Error.new("#{self.class.name} doesn't support URNs") if identifier.nil?
29
+ raise DropletKit::Error, "#{self.class.name} doesn't support URNs" if identifier.nil?
30
30
 
31
31
  identifier
32
32
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module DropletKit
4
4
  class ContainerRegistryRepository < BaseModel
5
- [:registry_name,:name,:latest_tag,:tag_count].each do |key|
5
+ %i[registry_name name latest_tag tag_count].each do |key|
6
6
  attribute(key)
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module DropletKit
4
4
  class ContainerRegistryRepositoryTag < BaseModel
5
- [:registry_name,:repository,:tag,:manifest_digest,:compressed_size_bytes,:size_bytes,:updated_at].each do |key|
5
+ %i[registry_name repository tag manifest_digest compressed_size_bytes size_bytes updated_at].each do |key|
6
6
  attribute(key)
7
7
  end
8
8
  end
@@ -17,4 +17,4 @@ module DropletKit
17
17
  new(name: identifier)
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module DropletKit
4
4
  class Droplet < BaseModel
5
- [:id, :name, :memory, :vcpus, :disk, :locked, :created_at,
6
- :status, :backup_ids, :snapshot_ids, :action_ids, :features,
7
- :region, :image, :networks, :kernel, :size_slug, :tags,
8
- :volume_ids].each do |key|
5
+ %i[id name memory vcpus disk locked created_at
6
+ status backup_ids snapshot_ids action_ids features
7
+ region image networks kernel size_slug tags
8
+ volume_ids].each do |key|
9
9
  attribute(key)
10
10
  end
11
11
 
@@ -24,12 +24,12 @@ module DropletKit
24
24
 
25
25
  def public_ip
26
26
  network = network_for(:v4, 'public')
27
- network && network.ip_address
27
+ network&.ip_address
28
28
  end
29
29
 
30
30
  def private_ip
31
31
  network = network_for(:v4, 'private')
32
- network && network.ip_address
32
+ network&.ip_address
33
33
  end
34
34
 
35
35
  private
@@ -46,4 +46,3 @@ module DropletKit
46
46
  end
47
47
  end
48
48
  end
49
-