Avoid overwritting parameters with local vars in method template
This commit is contained in:
parent
e1721c5c3f
commit
9c40b96d85
|
@ -6,7 +6,7 @@ module Google
|
||||||
module NameHelpers
|
module NameHelpers
|
||||||
KEYWORDS = %w(__ENCODING__ def in self __LINE__ defined? module super __FILE__ do next then BEGIN
|
KEYWORDS = %w(__ENCODING__ def in self __LINE__ defined? module super __FILE__ do next then BEGIN
|
||||||
else nil true END elsif not undef alias end or unless and ensure redo until begin
|
else nil true END elsif not undef alias end or unless and ensure redo until begin
|
||||||
false rescue when break for retry while case if return yield class)
|
false rescue when break for retry while case if return yield class command)
|
||||||
PLURAL_METHODS = %w(list search)
|
PLURAL_METHODS = %w(list search)
|
||||||
|
|
||||||
# Check to see if the method name should be plauralized
|
# Check to see if the method name should be plauralized
|
||||||
|
|
|
@ -50,24 +50,23 @@
|
||||||
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
||||||
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
||||||
def <%= api_method.generated_name %>(<% for param in api_method.required_parameters %><%= param.generated_name %>, <% end %><% if api_method.request %><%= api.schemas[api_method.request._ref].generated_name %>_object = nil, <% end %><% for param in api_method.optional_query_parameters %><%= param.generated_name %>: nil, <% end %><% for param in api.parameters.values.reject {|p| p.name == 'key'} %><%= param.generated_name %>: nil, <% end %><% if api_method.supports_media_upload? %>upload_source: nil, content_type: nil, <% elsif api_method.supports_media_download? %>download_dest: nil, <% end %>options: nil, &block)
|
def <%= api_method.generated_name %>(<% for param in api_method.required_parameters %><%= param.generated_name %>, <% end %><% if api_method.request %><%= api.schemas[api_method.request._ref].generated_name %>_object = nil, <% end %><% for param in api_method.optional_query_parameters %><%= param.generated_name %>: nil, <% end %><% for param in api.parameters.values.reject {|p| p.name == 'key'} %><%= param.generated_name %>: nil, <% end %><% if api_method.supports_media_upload? %>upload_source: nil, content_type: nil, <% elsif api_method.supports_media_download? %>download_dest: nil, <% end %>options: nil, &block)
|
||||||
path = '<%= api_method.path %>'
|
|
||||||
<% if api_method.supports_media_upload? -%>
|
<% if api_method.supports_media_upload? -%>
|
||||||
if upload_source.nil?
|
if upload_source.nil?
|
||||||
command = make_simple_command(:<%= api_method.http_method.downcase %>, path, options)
|
command = make_simple_command(:<%= api_method.http_method.downcase %>, '<%= api_method.path %>', options)
|
||||||
else
|
else
|
||||||
command = make_upload_command(:<%= api_method.http_method.downcase %>, path, options)
|
command = make_upload_command(:<%= api_method.http_method.downcase %>, '<%= api_method.path %>', options)
|
||||||
command.upload_source = upload_source
|
command.upload_source = upload_source
|
||||||
command.upload_content_type = content_type
|
command.upload_content_type = content_type
|
||||||
end
|
end
|
||||||
<% elsif api_method.supports_media_download? -%>
|
<% elsif api_method.supports_media_download? -%>
|
||||||
if download_dest.nil?
|
if download_dest.nil?
|
||||||
command = make_simple_command(:<%= api_method.http_method.downcase %>, path, options)
|
command = make_simple_command(:<%= api_method.http_method.downcase %>, '<%= api_method.path %>', options)
|
||||||
else
|
else
|
||||||
command = make_download_command(:<%= api_method.http_method.downcase %>, path, options)
|
command = make_download_command(:<%= api_method.http_method.downcase %>, '<%= api_method.path %>', options)
|
||||||
command.download_dest = download_dest
|
command.download_dest = download_dest
|
||||||
end
|
end
|
||||||
<% else -%>
|
<% else -%>
|
||||||
command = make_simple_command(:<%= api_method.http_method.downcase %>, path, options)
|
command = make_simple_command(:<%= api_method.http_method.downcase %>, '<%= api_method.path %>', options)
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if api_method.request -%>
|
<% if api_method.request -%>
|
||||||
command.request_representation = <%= api.schemas[api_method.request._ref].generated_type %>::Representation
|
command.request_representation = <%= api.schemas[api_method.request._ref].generated_type %>::Representation
|
||||||
|
|
Loading…
Reference in New Issue