Class: Google::Apis::LibraryagentV1::LibraryagentService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::LibraryagentV1::LibraryagentService
- Defined in:
- lib/google/apis/libraryagent_v1/service.rb
Overview
Library Agent API
A simple Google Example Library API.
Constant Summary collapse
- DEFAULT_ENDPOINT_TEMPLATE =
"https://libraryagent.$UNIVERSE_DOMAIN$/"
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Instance Method Summary collapse
-
#borrow_shelf_book(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book
Borrow a book from the library.
-
#get_shelf(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Shelf
Gets a shelf.
-
#get_shelf_book(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book
Gets a book.
-
#initialize ⇒ LibraryagentService
constructor
A new instance of LibraryagentService.
-
#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.
-
#list_shelves(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1ListShelvesResponse
Lists shelves.
-
#return_shelf_book(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::LibraryagentV1::GoogleExampleLibraryagentV1Book
Return a book to the library.
Constructor Details
#initialize ⇒ LibraryagentService
Returns a new instance of LibraryagentService.
47 48 49 50 51 52 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 47 def initialize super(DEFAULT_ENDPOINT_TEMPLATE, '', client_name: 'google-apis-libraryagent_v1', client_version: Google::Apis::LibraryagentV1::GEM_VERSION) @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
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.
40 41 42 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 40 def key @key end |
#quota_user ⇒ String
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.
45 46 47 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 45 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.
144 145 146 147 148 149 150 151 152 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 144 def borrow_shelf_book(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+name}:borrow', ) 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.
74 75 76 77 78 79 80 81 82 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 74 def get_shelf(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', ) 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.
174 175 176 177 178 179 180 181 182 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 174 def get_shelf_book(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', ) 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.
213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 213 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', ) 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.
110 111 112 113 114 115 116 117 118 119 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 110 def list_shelves(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/shelves', ) 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.
247 248 249 250 251 252 253 254 255 |
# File 'lib/google/apis/libraryagent_v1/service.rb', line 247 def return_shelf_book(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/{+name}:return', ) 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 |