2020-12-31 22:55:59 +00:00
|
|
|
# Copyright 2020 Google LLC
|
2015-04-17 00:28:38 +00:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
require 'google/apis/core/base_service'
|
|
|
|
require 'google/apis/core/json_representation'
|
|
|
|
require 'google/apis/core/hashable'
|
|
|
|
require 'google/apis/errors'
|
|
|
|
|
|
|
|
module Google
|
|
|
|
module Apis
|
|
|
|
module <%= api.module_name %>
|
|
|
|
# <%= api.title %>
|
|
|
|
#
|
|
|
|
# <%= block_comment(api.description, 6, 2) %>
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# require '<%= to_path(api.qualified_name) %>'
|
|
|
|
#
|
|
|
|
# <%= api.name %> = <%= api.qualified_name %> # Alias the module
|
|
|
|
# service = <%= api.name %>::<%= api.service_name %>.new
|
|
|
|
#
|
|
|
|
<% if api.documentation_link -%>
|
|
|
|
# @see <%= api.documentation_link %>
|
|
|
|
<% end -%>
|
|
|
|
class <%= api.service_name %> < Google::Apis::Core::BaseService
|
|
|
|
<% for param in api.parameters.values.reject {|p| p.name == 'fields'} -%>
|
|
|
|
# @return [<%= param.generated_type %>]
|
|
|
|
# <%= block_comment(param.description, 8, 2) %>
|
|
|
|
attr_accessor :<%= param.generated_name %>
|
|
|
|
|
|
|
|
<% end -%>
|
|
|
|
def initialize
|
2021-01-01 17:40:59 +00:00
|
|
|
super('<%= api.root_url %>', '<%= api.service_path %>',
|
|
|
|
client_name: '<%= api.gem_name %>',
|
|
|
|
client_version: <%= api.qualified_name %>::GEM_VERSION)
|
2017-03-06 20:24:30 +00:00
|
|
|
@batch_path = '<%= api.batch_path %>'
|
2015-04-17 00:28:38 +00:00
|
|
|
end
|
|
|
|
<% for api_method in api.all_methods -%>
|
|
|
|
<%= indent(include('method', :api_method => api_method, :api => api), 8) -%>
|
|
|
|
<% end -%>
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def apply_command_defaults(command)
|
|
|
|
<% for param in api.parameters.values.reject {|p| p.name == 'fields'} -%>
|
|
|
|
command.query['<%= param.name %>'] = <%= param.generated_name %> unless <%= param.generated_name %>.nil?
|
|
|
|
<% end -%>
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|