61 lines
2.0 KiB
Cheetah
61 lines
2.0 KiB
Cheetah
# Copyright 2015 Google Inc.
|
|
#
|
|
# 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
|
|
super('<%= api.root_url %>', '<%= api.service_path %>')
|
|
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
|