Class: Google::Apis::LibraryagentV1::LibraryagentService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
generated/google/apis/libraryagent_v1/service.rb

Overview

Library Agent API

A simple Google Example Library API.

Examples:

require 'google/apis/libraryagent_v1'

Libraryagent = Google::Apis::LibraryagentV1 # Alias the module
service = Libraryagent::LibraryagentService.new

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLibraryagentService

Returns a new instance of LibraryagentService.



45
46
47
48
# File 'generated/google/apis/libraryagent_v1/service.rb', line 45

def initialize
  super('https://libraryagent.googleapis.com/', '')
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



38
39
40
# File 'generated/google/apis/libraryagent_v1/service.rb', line 38

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



43
44
45
# File 'generated/google/apis/libraryagent_v1/service.rb', line 43

def quota_user
  @quota_user
end

Instance Method Details

#borrow_shelf_book(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book

Borrow a book from the library. Returns the book if it is borrowed successfully. Returns NOT_FOUND if the book does not exist in the library. Returns quota exceeded error if the amount of books borrowed exceeds allocation quota in any dimensions.

Parameters:

  • name (String)

    Required. The name of the book to borrow.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



140
141
142
143
144
145
146
147
148
# File 'generated/google/apis/libraryagent_v1/service.rb', line 140

def borrow_shelf_book(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+name}:borrow', options)
  command.response_representation = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book::Representation
  command.response_class = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_shelf(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Shelf

Gets a shelf. Returns NOT_FOUND if the shelf does not exist.

Parameters:

  • name (String)

    Required. The name of the shelf to retrieve.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



70
71
72
73
74
75
76
77
78
# File 'generated/google/apis/libraryagent_v1/service.rb', line 70

def get_shelf(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Shelf::Representation
  command.response_class = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Shelf
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_shelf_book(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book

Gets a book. Returns NOT_FOUND if the book does not exist.

Parameters:

  • name (String)

    Required. The name of the book to retrieve.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



170
171
172
173
174
175
176
177
178
# File 'generated/google/apis/libraryagent_v1/service.rb', line 170

def get_shelf_book(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book::Representation
  command.response_class = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_shelf_books(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1ListBooksResponse

Lists books in a shelf. The order is unspecified but deterministic. Newly created books will not necessarily be added to the end of this list. Returns NOT_FOUND if the shelf does not exist.

Parameters:

  • parent (String)

    Required. The name of the shelf whose books we'd like to list.

  • page_size (Fixnum) (defaults to: nil)

    Requested page size. Server may return fewer books than requested. If unspecified, server will pick an appropriate default.

  • page_token (String) (defaults to: nil)

    A token identifying a page of results the server should return. Typically, this is the value of ListBooksResponse.next_page_token. returned from the previous call to ListBooks method.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



209
210
211
212
213
214
215
216
217
218
219
# File 'generated/google/apis/libraryagent_v1/service.rb', line 209

def list_shelf_books(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+parent}/books', options)
  command.response_representation = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1ListBooksResponse::Representation
  command.response_class = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1ListBooksResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_shelves(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1ListShelvesResponse

Lists shelves. The order is unspecified but deterministic. Newly created shelves will not necessarily be added to the end of this list.

Parameters:

  • page_size (Fixnum) (defaults to: nil)

    Requested page size. Server may return fewer shelves than requested. If unspecified, server will pick an appropriate default.

  • page_token (String) (defaults to: nil)

    A token identifying a page of results the server should return. Typically, this is the value of ListShelvesResponse.next_page_token returned from the previous call to ListShelves method.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



106
107
108
109
110
111
112
113
114
115
# File 'generated/google/apis/libraryagent_v1/service.rb', line 106

def list_shelves(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/shelves', options)
  command.response_representation = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1ListShelvesResponse::Representation
  command.response_class = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1ListShelvesResponse
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#return_shelf_book(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book

Return a book to the library. Returns the book if it is returned to the library successfully. Returns error if the book does not belong to the library or the users didn't borrow before.

Parameters:

  • name (String)

    Required. The name of the book to return.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



243
244
245
246
247
248
249
250
251
# File 'generated/google/apis/libraryagent_v1/service.rb', line 243

def return_shelf_book(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+name}:return', options)
  command.response_representation = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book::Representation
  command.response_class = Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end