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.
- checksums.yaml +4 -4
- data/lib/droplet_kit/client.rb +1 -1
- data/lib/droplet_kit/error_handling_resourcable.rb +4 -3
- data/lib/droplet_kit/mappings/balance_mapping.rb +0 -1
- data/lib/droplet_kit/mappings/container_registry_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/database_cluster_mapping.rb +8 -8
- data/lib/droplet_kit/mappings/database_connection_pool_mapping.rb +5 -5
- data/lib/droplet_kit/mappings/database_eviction_policy_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/database_firewall_rule_mapping.rb +3 -3
- data/lib/droplet_kit/mappings/database_maintenance_window_mapping.rb +2 -2
- data/lib/droplet_kit/mappings/database_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/database_sql_mode_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/database_user_mapping.rb +3 -3
- data/lib/droplet_kit/mappings/database_user_reset_auth_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/domain_mapping.rb +2 -2
- data/lib/droplet_kit/mappings/domain_record_mapping.rb +9 -9
- data/lib/droplet_kit/mappings/droplet_upgrade_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/error_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/firewall_inbound_rule_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/firewall_outbound_rule_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/floating_ip_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/forwarding_rule_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/image_mapping.rb +10 -10
- data/lib/droplet_kit/mappings/invoice_mapping.rb +0 -1
- data/lib/droplet_kit/mappings/kernel_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/kubernetes_cluster_mapping.rb +9 -9
- data/lib/droplet_kit/mappings/kubernetes_node_mapping.rb +0 -1
- data/lib/droplet_kit/mappings/kubernetes_node_pool_mapping.rb +8 -9
- data/lib/droplet_kit/mappings/load_balancer_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/network_detail_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/network_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/project_assignment_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/project_mapping.rb +5 -5
- data/lib/droplet_kit/mappings/region_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/reserved_ip_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/size_mapping.rb +1 -0
- data/lib/droplet_kit/mappings/snapshot_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/ssh_key_mapping.rb +1 -1
- data/lib/droplet_kit/mappings/volume_mapping.rb +5 -6
- data/lib/droplet_kit/mappings/vpc_member_mapping.rb +1 -1
- data/lib/droplet_kit/models/base_model.rb +3 -3
- data/lib/droplet_kit/models/container_registry_repository.rb +1 -1
- data/lib/droplet_kit/models/container_registry_repository_tag.rb +1 -1
- data/lib/droplet_kit/models/domain.rb +1 -1
- data/lib/droplet_kit/models/droplet.rb +6 -7
- data/lib/droplet_kit/models/invoice.rb +15 -16
- data/lib/droplet_kit/models/kernel.rb +1 -1
- data/lib/droplet_kit/models/kubernetes_cluster.rb +1 -1
- data/lib/droplet_kit/models/kubernetes_node.rb +1 -1
- data/lib/droplet_kit/models/kubernetes_node_pool.rb +1 -1
- data/lib/droplet_kit/models/load_balancer.rb +4 -4
- data/lib/droplet_kit/models/meta_information.rb +1 -1
- data/lib/droplet_kit/models/pagination_information.rb +1 -1
- data/lib/droplet_kit/models/project.rb +1 -1
- data/lib/droplet_kit/models/size.rb +1 -0
- data/lib/droplet_kit/models/snapshot.rb +1 -1
- data/lib/droplet_kit/models/ssh_key.rb +1 -1
- data/lib/droplet_kit/models/volume.rb +1 -1
- data/lib/droplet_kit/models/vpc.rb +1 -1
- data/lib/droplet_kit/models/vpc_member.rb +1 -1
- data/lib/droplet_kit/paginated_resource.rb +10 -10
- data/lib/droplet_kit/resources/account_resource.rb +1 -1
- data/lib/droplet_kit/resources/balance_resource.rb +1 -1
- data/lib/droplet_kit/resources/domain_record_resource.rb +2 -2
- data/lib/droplet_kit/resources/droplet_action_resource.rb +5 -5
- data/lib/droplet_kit/resources/firewall_resource.rb +3 -3
- data/lib/droplet_kit/resources/image_resource.rb +1 -1
- data/lib/droplet_kit/resources/kubernetes_cluster_resource.rb +3 -5
- data/lib/droplet_kit/resources/load_balancer_resource.rb +1 -1
- data/lib/droplet_kit/resources/project_resource.rb +1 -1
- data/lib/droplet_kit/resources/ssh_key_resource.rb +3 -3
- data/lib/droplet_kit/resources/volume_action_resource.rb +3 -3
- data/lib/droplet_kit/resources/vpc_resource.rb +5 -5
- data/lib/droplet_kit/utils.rb +9 -9
- data/lib/droplet_kit/version.rb +1 -1
- data/lib/droplet_kit.rb +2 -2
- data/lib/tasks/resource_doc.rake +8 -9
- metadata +93 -23
@@ -1,20 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module DropletKit
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
4
|
+
class Invoice < BaseModel
|
5
|
+
attribute :invoice_uuid
|
6
|
+
attribute :amount
|
7
|
+
attribute :invoice_period
|
8
|
+
attribute :product
|
9
|
+
attribute :resource_uuid
|
10
|
+
attribute :group_description
|
11
|
+
attribute :description
|
12
|
+
attribute :duration
|
13
|
+
attribute :duration_unit
|
14
|
+
attribute :start_time
|
15
|
+
attribute :end_time
|
16
|
+
attribute :project_name
|
17
|
+
attribute :category
|
19
18
|
end
|
20
|
-
|
19
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DropletKit
|
4
4
|
class KubernetesCluster < BaseModel
|
5
|
-
[
|
5
|
+
%i[id name region version auto_upgrade cluster_subnet service_subnet ipv4 endpoint tags maintenance_policy node_pools vpc_uuid ha].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 KubernetesNodePool < BaseModel
|
5
|
-
[
|
5
|
+
%i[id name size count tags labels nodes auto_scale min_nodes max_nodes].each do |key|
|
6
6
|
attribute(key)
|
7
7
|
end
|
8
8
|
end
|
@@ -12,10 +12,10 @@ module DropletKit
|
|
12
12
|
attribute :region
|
13
13
|
attribute :size
|
14
14
|
attribute :size_unit
|
15
|
-
attribute :redirect_http_to_https, Boolean, :
|
16
|
-
attribute :enable_proxy_protocol, Boolean, :
|
17
|
-
attribute :enable_backend_keepalive, Boolean, :
|
18
|
-
attribute :disable_lets_encrypt_dns_records, Boolean, :
|
15
|
+
attribute :redirect_http_to_https, Boolean, default: false
|
16
|
+
attribute :enable_proxy_protocol, Boolean, default: false
|
17
|
+
attribute :enable_backend_keepalive, Boolean, default: false
|
18
|
+
attribute :disable_lets_encrypt_dns_records, Boolean, default: false
|
19
19
|
attribute :droplet_ids
|
20
20
|
attribute :sticky_sessions, StickySession
|
21
21
|
attribute :health_check
|
@@ -16,7 +16,7 @@ module DropletKit
|
|
16
16
|
@resource = resource
|
17
17
|
@collection = []
|
18
18
|
@args = args
|
19
|
-
@options = args.last.
|
19
|
+
@options = args.last.is_a?(Hash) ? args.last : {}
|
20
20
|
end
|
21
21
|
|
22
22
|
def per_page
|
@@ -31,10 +31,9 @@ module DropletKit
|
|
31
31
|
# Start off with the first page if we have no idea of anything yet
|
32
32
|
fetch_next_page if total.nil?
|
33
33
|
|
34
|
-
return to_enum(:each, start) unless
|
35
|
-
|
36
|
-
|
37
|
-
end
|
34
|
+
return to_enum(:each, start) unless block
|
35
|
+
|
36
|
+
Array(@collection[start..-1]).each(&block)
|
38
37
|
|
39
38
|
unless last?
|
40
39
|
start = [@collection.size, start].max
|
@@ -46,18 +45,19 @@ module DropletKit
|
|
46
45
|
end
|
47
46
|
|
48
47
|
def last?
|
49
|
-
return true if
|
50
|
-
|
48
|
+
return true if total.nil?
|
49
|
+
|
50
|
+
@current_page == total_pages || total.zero?
|
51
51
|
end
|
52
52
|
|
53
53
|
def total_pages
|
54
|
-
return nil if
|
54
|
+
return nil if total.nil?
|
55
55
|
|
56
|
-
(
|
56
|
+
(total.to_f / per_page).ceil
|
57
57
|
end
|
58
58
|
|
59
59
|
def ==(other)
|
60
|
-
each_with_index.each.all? {|object, index| object == other[index] }
|
60
|
+
each_with_index.each.all? { |object, index| object == other[index] }
|
61
61
|
end
|
62
62
|
|
63
63
|
private
|
@@ -5,7 +5,7 @@ module DropletKit
|
|
5
5
|
include ErrorHandlingResourcable
|
6
6
|
|
7
7
|
resources do
|
8
|
-
default_handler(:ok) {|r| BalanceMapping.extract_single(r.body, :read) }
|
8
|
+
default_handler(:ok) { |r| BalanceMapping.extract_single(r.body, :read) }
|
9
9
|
get '/v2/customers/my/balance' => :info
|
10
10
|
end
|
11
11
|
end
|
@@ -11,7 +11,7 @@ module DropletKit
|
|
11
11
|
end
|
12
12
|
|
13
13
|
action :create, 'POST /v2/domains/:for_domain/records' do
|
14
|
-
body {|object| DomainRecordMapping.representation_for(:create, object) }
|
14
|
+
body { |object| DomainRecordMapping.representation_for(:create, object) }
|
15
15
|
handler(201) { |response| DomainRecordMapping.extract_single(response.body, :read) }
|
16
16
|
end
|
17
17
|
|
@@ -24,7 +24,7 @@ module DropletKit
|
|
24
24
|
end
|
25
25
|
|
26
26
|
action :update, 'PUT /v2/domains/:for_domain/records/:id' do
|
27
|
-
body {|object| DomainRecordMapping.representation_for(:update, object) }
|
27
|
+
body { |object| DomainRecordMapping.representation_for(:update, object) }
|
28
28
|
handler(200) { |response| DomainRecordMapping.extract_single(response.body, :read) }
|
29
29
|
end
|
30
30
|
end
|
@@ -4,14 +4,14 @@ module DropletKit
|
|
4
4
|
class DropletActionResource < ResourceKit::Resource
|
5
5
|
include ErrorHandlingResourcable
|
6
6
|
|
7
|
-
ACTIONS_WITHOUT_INPUT = %w
|
8
|
-
|
9
|
-
|
7
|
+
ACTIONS_WITHOUT_INPUT = %w[reboot power_cycle shutdown power_off power_on
|
8
|
+
password_reset enable_ipv6 enable_backups disable_backups
|
9
|
+
enable_private_networking].freeze
|
10
10
|
|
11
|
-
TAG_ACTIONS = %w
|
11
|
+
TAG_ACTIONS = %w[
|
12
12
|
enable_backups disable_backups power_cycle power_on power_off shutdown
|
13
13
|
enable_private_networking enable_ipv6 snapshot
|
14
|
-
|
14
|
+
].freeze
|
15
15
|
|
16
16
|
resources do
|
17
17
|
default_handler(422) { |response| ErrorMapping.fail_with(FailedCreate, response.body) }
|
@@ -45,13 +45,13 @@ module DropletKit
|
|
45
45
|
handler(204) { |_| true }
|
46
46
|
end
|
47
47
|
|
48
|
-
action :add_tags, 'POST /v2/firewalls/:id/tags'
|
49
|
-
body { |tags| { tags: tags}.to_json }
|
48
|
+
action :add_tags, 'POST /v2/firewalls/:id/tags' do
|
49
|
+
body { |tags| { tags: tags }.to_json }
|
50
50
|
handler(204) { |_| true }
|
51
51
|
end
|
52
52
|
|
53
53
|
action :remove_tags, 'DELETE /v2/firewalls/:id/tags' do
|
54
|
-
body { |tags| { tags: tags}.to_json }
|
54
|
+
body { |tags| { tags: tags }.to_json }
|
55
55
|
handler(204) { |_| true }
|
56
56
|
end
|
57
57
|
|
@@ -19,7 +19,7 @@ module DropletKit
|
|
19
19
|
end
|
20
20
|
|
21
21
|
action :update, 'PUT /v2/images/:id' do
|
22
|
-
body {|image| ImageMapping.representation_for(:update, image) }
|
22
|
+
body { |image| ImageMapping.representation_for(:update, image) }
|
23
23
|
handler(200) { |response| ImageMapping.extract_single(response.body, :read) }
|
24
24
|
end
|
25
25
|
end
|
@@ -15,17 +15,15 @@ module DropletKit
|
|
15
15
|
end
|
16
16
|
|
17
17
|
action :create, 'POST /v2/kubernetes/clusters' do
|
18
|
-
body do |object|
|
18
|
+
body do |object|
|
19
19
|
# This ensures that both a hash and an instance of KubernetesNodePool can be passed
|
20
20
|
# into the node_pools array
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# Ex:
|
23
23
|
# KubernetesCluster.new(node_pools: [{}])
|
24
24
|
# or
|
25
25
|
# KubernetesCluster.new(node_pools: [KubernetesNodePool.new()])
|
26
|
-
if object.respond_to?(:node_pools) && object.node_pools.respond_to?(:map)
|
27
|
-
object.node_pools = object.node_pools.map(&:to_hash)
|
28
|
-
end
|
26
|
+
object.node_pools = object.node_pools.map(&:to_hash) if object.respond_to?(:node_pools) && object.node_pools.respond_to?(:map)
|
29
27
|
|
30
28
|
KubernetesClusterMapping.representation_for(:create, object)
|
31
29
|
end
|
@@ -21,7 +21,7 @@ module DropletKit
|
|
21
21
|
end
|
22
22
|
|
23
23
|
action :update, 'PUT /v2/load_balancers/:id' do
|
24
|
-
body {|load_balancer| LoadBalancerMapping.representation_for(:update, load_balancer) }
|
24
|
+
body { |load_balancer| LoadBalancerMapping.representation_for(:update, load_balancer) }
|
25
25
|
handler(200) { |response| LoadBalancerMapping.extract_single(response.body, :read) }
|
26
26
|
handler(422) { |response| ErrorMapping.fail_with(FailedUpdate, response.body) }
|
27
27
|
end
|
@@ -54,7 +54,7 @@ module DropletKit
|
|
54
54
|
elsif resource.respond_to?(:urn) && resource.urn && DropletKit::BaseModel.valid_urn?(resource.urn)
|
55
55
|
resource.urn
|
56
56
|
else
|
57
|
-
raise DropletKit::Error
|
57
|
+
raise DropletKit::Error, "cannot assign resource without valid urn: #{resource}"
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -5,7 +5,7 @@ module DropletKit
|
|
5
5
|
include ErrorHandlingResourcable
|
6
6
|
|
7
7
|
resources do
|
8
|
-
default_handler(:ok, :created) {|r| SSHKeyMapping.extract_single(r.body, :read) }
|
8
|
+
default_handler(:ok, :created) { |r| SSHKeyMapping.extract_single(r.body, :read) }
|
9
9
|
|
10
10
|
action :all, 'GET /v2/account/keys' do
|
11
11
|
query_keys :per_page, :page
|
@@ -13,14 +13,14 @@ module DropletKit
|
|
13
13
|
end
|
14
14
|
|
15
15
|
action :create, 'POST /v2/account/keys' do
|
16
|
-
body {|object| SSHKeyMapping.representation_for(:create, object) }
|
16
|
+
body { |object| SSHKeyMapping.representation_for(:create, object) }
|
17
17
|
end
|
18
18
|
|
19
19
|
action :find, 'GET /v2/account/keys/:id'
|
20
20
|
action :delete, 'DELETE /v2/account/keys/:id'
|
21
21
|
|
22
22
|
action :update, 'PUT /v2/account/keys/:id' do
|
23
|
-
body {|ssh_key| SSHKeyMapping.representation_for(:update, ssh_key) }
|
23
|
+
body { |ssh_key| SSHKeyMapping.representation_for(:update, ssh_key) }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -11,7 +11,7 @@ module DropletKit
|
|
11
11
|
type: 'attach',
|
12
12
|
droplet_id: hash[:droplet_id],
|
13
13
|
volume_id: hash[:volume_id], # seems redundant to the id in the url?
|
14
|
-
region: hash[:region]
|
14
|
+
region: hash[:region] # seems redundant - inferred from the droplet?
|
15
15
|
}.to_json
|
16
16
|
end
|
17
17
|
handler(201, 200) { |response| ActionMapping.extract_single(response.body, :read) }
|
@@ -23,7 +23,7 @@ module DropletKit
|
|
23
23
|
type: 'detach',
|
24
24
|
droplet_id: hash[:droplet_id],
|
25
25
|
volume_id: hash[:volume_id], # seems redundant to the id in the url?
|
26
|
-
region: hash[:region]
|
26
|
+
region: hash[:region] # seems redundant - inferred from the droplet?
|
27
27
|
}.to_json
|
28
28
|
end
|
29
29
|
handler(201, 200) { |response| ActionMapping.extract_single(response.body, :read) }
|
@@ -34,7 +34,7 @@ module DropletKit
|
|
34
34
|
{
|
35
35
|
type: 'resize',
|
36
36
|
size_gigabytes: hash[:size_gigabytes],
|
37
|
-
region: hash[:region]
|
37
|
+
region: hash[:region]
|
38
38
|
}.to_json
|
39
39
|
end
|
40
40
|
handler(201, 200) { |response| ActionMapping.extract_single(response.body, :read) }
|
@@ -26,16 +26,16 @@ module DropletKit
|
|
26
26
|
end
|
27
27
|
|
28
28
|
action :update, 'PUT /v2/vpcs/:id' do
|
29
|
-
body {|vpc| VPCMapping.representation_for(:update, vpc) }
|
29
|
+
body { |vpc| VPCMapping.representation_for(:update, vpc) }
|
30
30
|
handler(200) { |response| VPCMapping.extract_single(response.body, :read) }
|
31
31
|
handler(422) { |response| ErrorMapping.fail_with(FailedUpdate, response.body) }
|
32
32
|
end
|
33
33
|
|
34
34
|
action :patch, 'PATCH /v2/vpcs/:id' do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
body { |vpc| VPCMapping.representation_for(:patch, vpc) }
|
36
|
+
handler(200) { |response| VPCMapping.extract_single(response.body, :read) }
|
37
|
+
handler(422) { |response| ErrorMapping.fail_with(FailedUpdate, response.body) }
|
38
|
+
end
|
39
39
|
|
40
40
|
action :delete, 'DELETE /v2/vpcs/:id' do
|
41
41
|
handler(204) { |_| true }
|
data/lib/droplet_kit/utils.rb
CHANGED
@@ -5,29 +5,29 @@ module DropletKit
|
|
5
5
|
def self.camelize(term)
|
6
6
|
string = term.to_s
|
7
7
|
string.sub!(/^[a-z\d]*/, &:capitalize)
|
8
|
-
string.gsub!(%r{(?:_|(/))([a-z\d]*)}i) {
|
9
|
-
string.gsub!('/'
|
8
|
+
string.gsub!(%r{(?:_|(/))([a-z\d]*)}i) { Regexp.last_match(2).capitalize }
|
9
|
+
string.gsub!('/', '::')
|
10
10
|
string
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.underscore(term)
|
14
|
-
return term unless /[A-Z-]
|
14
|
+
return term unless /[A-Z-]|::/.match?(term)
|
15
15
|
|
16
|
-
word = term.to_s.gsub('::'
|
17
|
-
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2'
|
18
|
-
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2'
|
19
|
-
word.tr!('-'
|
16
|
+
word = term.to_s.gsub('::', '/')
|
17
|
+
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
18
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
19
|
+
word.tr!('-', '_')
|
20
20
|
word.downcase!
|
21
21
|
word
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.transform_keys(hash, &block)
|
25
25
|
return hash.transform_keys(&block) if hash.respond_to?(:transform_keys)
|
26
|
-
return to_enum(__caller__) unless
|
26
|
+
return to_enum(__caller__) unless block
|
27
27
|
|
28
28
|
{}.tap do |result|
|
29
29
|
hash.each do |key, value|
|
30
|
-
result[
|
30
|
+
result[yield(key)] = value
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/lib/droplet_kit/version.rb
CHANGED
data/lib/droplet_kit.rb
CHANGED
data/lib/tasks/resource_doc.rake
CHANGED
@@ -4,17 +4,16 @@ require 'droplet_kit'
|
|
4
4
|
require 'droplet_kit/utils'
|
5
5
|
|
6
6
|
namespace :doc do
|
7
|
+
desc 'Generate a resource documentation'
|
7
8
|
task :resources do
|
8
9
|
resources = DropletKit::Client.resources
|
9
10
|
|
10
11
|
resources.each do |key, klass|
|
11
|
-
if (
|
12
|
-
next
|
13
|
-
end
|
12
|
+
next if ENV.fetch('SKIP_CLASSES', '').split(',').include?(klass.name)
|
14
13
|
|
15
|
-
class_name = DropletKit::Utils.underscore klass.name.split('::'
|
14
|
+
class_name = DropletKit::Utils.underscore klass.name.split('::').last
|
16
15
|
human_name = class_name.dup
|
17
|
-
human_name.tr!('_'
|
16
|
+
human_name.tr!('_', ' ')
|
18
17
|
human_name.gsub!(/([a-z\d]*)/i) { |match| match.downcase }
|
19
18
|
human_name.gsub!(/\A\w/) { |match| match.upcase }
|
20
19
|
|
@@ -23,13 +22,13 @@ namespace :doc do
|
|
23
22
|
puts " client = DropletKit::Client.new(access_token: 'TOKEN')"
|
24
23
|
puts " client.#{key} #=> #{klass.name}"
|
25
24
|
puts
|
26
|
-
puts
|
25
|
+
puts 'Actions supported: '
|
27
26
|
puts
|
28
27
|
klass._resources.each do |action|
|
29
|
-
action_options = action.path.scan(
|
28
|
+
action_options = action.path.scan(/:[\w_\-]+/i)
|
30
29
|
params = []
|
31
30
|
|
32
|
-
if action.body
|
31
|
+
if action.body&.arity&.positive?
|
33
32
|
resource = class_name.dup
|
34
33
|
resource.gsub!('_resource', '')
|
35
34
|
resource.downcase!
|
@@ -38,7 +37,7 @@ namespace :doc do
|
|
38
37
|
|
39
38
|
if action_options.any?
|
40
39
|
action_string = action_options.map do |option|
|
41
|
-
option.gsub!(
|
40
|
+
option.gsub!(/^:/, '')
|
42
41
|
"#{option}: '#{option}'"
|
43
42
|
end.join(', ')
|
44
43
|
|