lib/haveapi/go_client/action.rb in haveapi-go-client-0.20.0 vs lib/haveapi/go_client/action.rb in haveapi-go-client-0.21.0
- old
+ new
@@ -57,16 +57,16 @@
def initialize(resource, name, desc, prefix: nil)
@resource = resource
@name = name.to_s
@prefix = prefix
@aliases = desc[:aliases]
- @full_dot_name = resource.full_dot_name + '#' + @name.capitalize
+ @full_dot_name = "#{resource.full_dot_name}##{@name.capitalize}"
@go_name = camelize(name)
@go_type = full_go_type
- @go_invocation_type = go_type + 'Invocation'
- @go_request_type = go_type + 'Request'
- @go_response_type = go_type + 'Response'
+ @go_invocation_type = "#{go_type}Invocation"
+ @go_request_type = "#{go_type}Request"
+ @go_response_type = "#{go_type}Response"
@input = desc[:input] && InputOutput.new(self, :io, :input, desc[:input])
@output = desc[:output] && InputOutput.new(self, :io, :output, desc[:output])
@http_method = desc[:method]
@path = desc[:path]
@metadata = desc[:meta] && Metadata.new(self, desc[:meta])
@@ -94,39 +94,38 @@
def has_output?
output && output.parameters.any?
end
def input_output
- %i(input output).select do |v|
+ %i[input output].select do |v|
send(v) && send(v).parameters.any?
end.map { |v| send(v) }
end
def blocking?
@blocking
end
def resolve_associations
- input_output.each do |io|
- io.resolve_associations
- end
+ input_output.each(&:resolve_associations)
metadata && metadata.resolve_associations
end
def <=>(other)
go_name <=> other.go_name
end
protected
+
attr_reader :prefix
def full_go_type
names = []
names << camelize(prefix) if prefix
names << 'Action'
names.concat(resource.resource_path.map(&:go_name))
names << go_name
- names.join('')
+ names.join
end
end
end