google-apis-blogger_v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,350 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module BloggerV2
23
+ # Blogger API v3
24
+ #
25
+ # The Blogger API provides access to posts, comments and pages of a Blogger blog.
26
+ #
27
+ # @example
28
+ # require 'google/apis/blogger_v2'
29
+ #
30
+ # Blogger = Google::Apis::BloggerV2 # Alias the module
31
+ # service = Blogger::BloggerService.new
32
+ #
33
+ # @see https://developers.google.com/blogger/docs/3.0/getting_started
34
+ class BloggerService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://blogger.googleapis.com/', '',
47
+ client_name: 'google-apis-blogger_v2',
48
+ client_version: Google::Apis::BloggerV2::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Gets a blog by id.
53
+ # @param [String] blog_id
54
+ # @param [String] fields
55
+ # Selector specifying which fields to include in a partial response.
56
+ # @param [String] quota_user
57
+ # Available to use for quota purposes for server-side applications. Can be any
58
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
59
+ # @param [Google::Apis::RequestOptions] options
60
+ # Request-specific options
61
+ #
62
+ # @yield [result, err] Result & error if block supplied
63
+ # @yieldparam result [Google::Apis::BloggerV2::Blog] parsed result object
64
+ # @yieldparam err [StandardError] error object if request failed
65
+ #
66
+ # @return [Google::Apis::BloggerV2::Blog]
67
+ #
68
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
69
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
70
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
71
+ def get_blog(blog_id, fields: nil, quota_user: nil, options: nil, &block)
72
+ command = make_simple_command(:get, 'v2/blogs/{blogId}', options)
73
+ command.response_representation = Google::Apis::BloggerV2::Blog::Representation
74
+ command.response_class = Google::Apis::BloggerV2::Blog
75
+ command.params['blogId'] = blog_id unless blog_id.nil?
76
+ command.query['fields'] = fields unless fields.nil?
77
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
78
+ execute_or_queue_command(command, &block)
79
+ end
80
+
81
+ # Lists blogs by user id, possibly filtered.
82
+ # @param [String] user_id
83
+ # @param [String] fields
84
+ # Selector specifying which fields to include in a partial response.
85
+ # @param [String] quota_user
86
+ # Available to use for quota purposes for server-side applications. Can be any
87
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
88
+ # @param [Google::Apis::RequestOptions] options
89
+ # Request-specific options
90
+ #
91
+ # @yield [result, err] Result & error if block supplied
92
+ # @yieldparam result [Google::Apis::BloggerV2::BlogList] parsed result object
93
+ # @yieldparam err [StandardError] error object if request failed
94
+ #
95
+ # @return [Google::Apis::BloggerV2::BlogList]
96
+ #
97
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
98
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
99
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
100
+ def list_blogs(user_id, fields: nil, quota_user: nil, options: nil, &block)
101
+ command = make_simple_command(:get, 'v2/users/{userId}/blogs', options)
102
+ command.response_representation = Google::Apis::BloggerV2::BlogList::Representation
103
+ command.response_class = Google::Apis::BloggerV2::BlogList
104
+ command.params['userId'] = user_id unless user_id.nil?
105
+ command.query['fields'] = fields unless fields.nil?
106
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
107
+ execute_or_queue_command(command, &block)
108
+ end
109
+
110
+ # Gets a comment by blog id, post id and comment id.
111
+ # @param [String] blog_id
112
+ # @param [String] post_id
113
+ # @param [String] comment_id
114
+ # @param [String] fields
115
+ # Selector specifying which fields to include in a partial response.
116
+ # @param [String] quota_user
117
+ # Available to use for quota purposes for server-side applications. Can be any
118
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
119
+ # @param [Google::Apis::RequestOptions] options
120
+ # Request-specific options
121
+ #
122
+ # @yield [result, err] Result & error if block supplied
123
+ # @yieldparam result [Google::Apis::BloggerV2::Comment] parsed result object
124
+ # @yieldparam err [StandardError] error object if request failed
125
+ #
126
+ # @return [Google::Apis::BloggerV2::Comment]
127
+ #
128
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
129
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
130
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
131
+ def get_comment(blog_id, post_id, comment_id, fields: nil, quota_user: nil, options: nil, &block)
132
+ command = make_simple_command(:get, 'v2/blogs/{blogId}/posts/{postId}/comments/{commentId}', options)
133
+ command.response_representation = Google::Apis::BloggerV2::Comment::Representation
134
+ command.response_class = Google::Apis::BloggerV2::Comment
135
+ command.params['blogId'] = blog_id unless blog_id.nil?
136
+ command.params['postId'] = post_id unless post_id.nil?
137
+ command.params['commentId'] = comment_id unless comment_id.nil?
138
+ command.query['fields'] = fields unless fields.nil?
139
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
140
+ execute_or_queue_command(command, &block)
141
+ end
142
+
143
+ # Lists comments.
144
+ # @param [String] blog_id
145
+ # @param [String] post_id
146
+ # @param [Boolean] fetch_bodies
147
+ # @param [Fixnum] max_results
148
+ # @param [String] page_token
149
+ # @param [String] start_date
150
+ # @param [String] fields
151
+ # Selector specifying which fields to include in a partial response.
152
+ # @param [String] quota_user
153
+ # Available to use for quota purposes for server-side applications. Can be any
154
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
155
+ # @param [Google::Apis::RequestOptions] options
156
+ # Request-specific options
157
+ #
158
+ # @yield [result, err] Result & error if block supplied
159
+ # @yieldparam result [Google::Apis::BloggerV2::CommentList] parsed result object
160
+ # @yieldparam err [StandardError] error object if request failed
161
+ #
162
+ # @return [Google::Apis::BloggerV2::CommentList]
163
+ #
164
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
165
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
166
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
167
+ def list_comments(blog_id, post_id, fetch_bodies: nil, max_results: nil, page_token: nil, start_date: nil, fields: nil, quota_user: nil, options: nil, &block)
168
+ command = make_simple_command(:get, 'v2/blogs/{blogId}/posts/{postId}/comments', options)
169
+ command.response_representation = Google::Apis::BloggerV2::CommentList::Representation
170
+ command.response_class = Google::Apis::BloggerV2::CommentList
171
+ command.params['blogId'] = blog_id unless blog_id.nil?
172
+ command.params['postId'] = post_id unless post_id.nil?
173
+ command.query['fetchBodies'] = fetch_bodies unless fetch_bodies.nil?
174
+ command.query['maxResults'] = max_results unless max_results.nil?
175
+ command.query['pageToken'] = page_token unless page_token.nil?
176
+ command.query['startDate'] = start_date unless start_date.nil?
177
+ command.query['fields'] = fields unless fields.nil?
178
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
179
+ execute_or_queue_command(command, &block)
180
+ end
181
+
182
+ # Gets a page by blog id and page id.
183
+ # @param [String] blog_id
184
+ # @param [String] page_id
185
+ # @param [String] fields
186
+ # Selector specifying which fields to include in a partial response.
187
+ # @param [String] quota_user
188
+ # Available to use for quota purposes for server-side applications. Can be any
189
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
190
+ # @param [Google::Apis::RequestOptions] options
191
+ # Request-specific options
192
+ #
193
+ # @yield [result, err] Result & error if block supplied
194
+ # @yieldparam result [Google::Apis::BloggerV2::Page] parsed result object
195
+ # @yieldparam err [StandardError] error object if request failed
196
+ #
197
+ # @return [Google::Apis::BloggerV2::Page]
198
+ #
199
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
200
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
201
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
202
+ def get_page(blog_id, page_id, fields: nil, quota_user: nil, options: nil, &block)
203
+ command = make_simple_command(:get, 'v2/blogs/{blogId}/pages/{pageId}', options)
204
+ command.response_representation = Google::Apis::BloggerV2::Page::Representation
205
+ command.response_class = Google::Apis::BloggerV2::Page
206
+ command.params['blogId'] = blog_id unless blog_id.nil?
207
+ command.params['pageId'] = page_id unless page_id.nil?
208
+ command.query['fields'] = fields unless fields.nil?
209
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
210
+ execute_or_queue_command(command, &block)
211
+ end
212
+
213
+ # Lists pages.
214
+ # @param [String] blog_id
215
+ # @param [Boolean] fetch_bodies
216
+ # @param [String] fields
217
+ # Selector specifying which fields to include in a partial response.
218
+ # @param [String] quota_user
219
+ # Available to use for quota purposes for server-side applications. Can be any
220
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
221
+ # @param [Google::Apis::RequestOptions] options
222
+ # Request-specific options
223
+ #
224
+ # @yield [result, err] Result & error if block supplied
225
+ # @yieldparam result [Google::Apis::BloggerV2::PageList] parsed result object
226
+ # @yieldparam err [StandardError] error object if request failed
227
+ #
228
+ # @return [Google::Apis::BloggerV2::PageList]
229
+ #
230
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
231
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
232
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
233
+ def list_pages(blog_id, fetch_bodies: nil, fields: nil, quota_user: nil, options: nil, &block)
234
+ command = make_simple_command(:get, 'v2/blogs/{blogId}/pages', options)
235
+ command.response_representation = Google::Apis::BloggerV2::PageList::Representation
236
+ command.response_class = Google::Apis::BloggerV2::PageList
237
+ command.params['blogId'] = blog_id unless blog_id.nil?
238
+ command.query['fetchBodies'] = fetch_bodies unless fetch_bodies.nil?
239
+ command.query['fields'] = fields unless fields.nil?
240
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
241
+ execute_or_queue_command(command, &block)
242
+ end
243
+
244
+ # Gets a post by blog id and post id
245
+ # @param [String] blog_id
246
+ # @param [String] post_id
247
+ # @param [String] fields
248
+ # Selector specifying which fields to include in a partial response.
249
+ # @param [String] quota_user
250
+ # Available to use for quota purposes for server-side applications. Can be any
251
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
252
+ # @param [Google::Apis::RequestOptions] options
253
+ # Request-specific options
254
+ #
255
+ # @yield [result, err] Result & error if block supplied
256
+ # @yieldparam result [Google::Apis::BloggerV2::Post] parsed result object
257
+ # @yieldparam err [StandardError] error object if request failed
258
+ #
259
+ # @return [Google::Apis::BloggerV2::Post]
260
+ #
261
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
262
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
263
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
264
+ def get_post(blog_id, post_id, fields: nil, quota_user: nil, options: nil, &block)
265
+ command = make_simple_command(:get, 'v2/blogs/{blogId}/posts/{postId}', options)
266
+ command.response_representation = Google::Apis::BloggerV2::Post::Representation
267
+ command.response_class = Google::Apis::BloggerV2::Post
268
+ command.params['blogId'] = blog_id unless blog_id.nil?
269
+ command.params['postId'] = post_id unless post_id.nil?
270
+ command.query['fields'] = fields unless fields.nil?
271
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
272
+ execute_or_queue_command(command, &block)
273
+ end
274
+
275
+ # Lists posts.
276
+ # @param [String] blog_id
277
+ # @param [Boolean] fetch_bodies
278
+ # @param [Fixnum] max_results
279
+ # @param [String] page_token
280
+ # @param [String] start_date
281
+ # @param [String] fields
282
+ # Selector specifying which fields to include in a partial response.
283
+ # @param [String] quota_user
284
+ # Available to use for quota purposes for server-side applications. Can be any
285
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
286
+ # @param [Google::Apis::RequestOptions] options
287
+ # Request-specific options
288
+ #
289
+ # @yield [result, err] Result & error if block supplied
290
+ # @yieldparam result [Google::Apis::BloggerV2::PostList] parsed result object
291
+ # @yieldparam err [StandardError] error object if request failed
292
+ #
293
+ # @return [Google::Apis::BloggerV2::PostList]
294
+ #
295
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
296
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
297
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
298
+ def list_posts(blog_id, fetch_bodies: nil, max_results: nil, page_token: nil, start_date: nil, fields: nil, quota_user: nil, options: nil, &block)
299
+ command = make_simple_command(:get, 'v2/blogs/{blogId}/posts', options)
300
+ command.response_representation = Google::Apis::BloggerV2::PostList::Representation
301
+ command.response_class = Google::Apis::BloggerV2::PostList
302
+ command.params['blogId'] = blog_id unless blog_id.nil?
303
+ command.query['fetchBodies'] = fetch_bodies unless fetch_bodies.nil?
304
+ command.query['maxResults'] = max_results unless max_results.nil?
305
+ command.query['pageToken'] = page_token unless page_token.nil?
306
+ command.query['startDate'] = start_date unless start_date.nil?
307
+ command.query['fields'] = fields unless fields.nil?
308
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
309
+ execute_or_queue_command(command, &block)
310
+ end
311
+
312
+ # Gets a user by user id.
313
+ # @param [String] user_id
314
+ # @param [String] fields
315
+ # Selector specifying which fields to include in a partial response.
316
+ # @param [String] quota_user
317
+ # Available to use for quota purposes for server-side applications. Can be any
318
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
319
+ # @param [Google::Apis::RequestOptions] options
320
+ # Request-specific options
321
+ #
322
+ # @yield [result, err] Result & error if block supplied
323
+ # @yieldparam result [Google::Apis::BloggerV2::User] parsed result object
324
+ # @yieldparam err [StandardError] error object if request failed
325
+ #
326
+ # @return [Google::Apis::BloggerV2::User]
327
+ #
328
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
329
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
330
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
331
+ def get_user(user_id, fields: nil, quota_user: nil, options: nil, &block)
332
+ command = make_simple_command(:get, 'v2/users/{userId}', options)
333
+ command.response_representation = Google::Apis::BloggerV2::User::Representation
334
+ command.response_class = Google::Apis::BloggerV2::User
335
+ command.params['userId'] = user_id unless user_id.nil?
336
+ command.query['fields'] = fields unless fields.nil?
337
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
338
+ execute_or_queue_command(command, &block)
339
+ end
340
+
341
+ protected
342
+
343
+ def apply_command_defaults(command)
344
+ command.query['key'] = key unless key.nil?
345
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
346
+ end
347
+ end
348
+ end
349
+ end
350
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google-apis-blogger_v2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Google LLC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google-apis-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ description: This is the simple REST client for Blogger API v3 V2. Simple REST clients
28
+ are Ruby client libraries that provide access to Google services via their HTTP
29
+ REST API endpoints. These libraries are generated and updated automatically based
30
+ on the discovery documents published by the service, and they handle most concerns
31
+ such as authentication, pagination, retry, timeouts, and logging. You can use this
32
+ client to access the Blogger API v3, but note that some services may provide a separate
33
+ modern client that is easier to use.
34
+ email: googleapis-packages@google.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".yardopts"
40
+ - CHANGELOG.md
41
+ - LICENSE.md
42
+ - OVERVIEW.md
43
+ - lib/google-apis-blogger_v2.rb
44
+ - lib/google/apis/blogger_v2.rb
45
+ - lib/google/apis/blogger_v2/classes.rb
46
+ - lib/google/apis/blogger_v2/gem_version.rb
47
+ - lib/google/apis/blogger_v2/representations.rb
48
+ - lib/google/apis/blogger_v2/service.rb
49
+ homepage: https://github.com/google/google-api-ruby-client
50
+ licenses:
51
+ - Apache-2.0
52
+ metadata:
53
+ bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
54
+ changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-blogger_v2/CHANGELOG.md
55
+ documentation_uri: https://googleapis.dev/ruby/google-apis-blogger_v2/v0.1.0
56
+ source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-blogger_v2
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '2.4'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.1.4
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Simple REST client for Blogger API v3 V2
76
+ test_files: []