Class: Google::Apis::BloggerV2::BloggerService

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

Overview

Blogger API

The Blogger API provides access to posts, comments and pages of a Blogger blog.

Examples:

require 'google/apis/blogger_v2'

Blogger = Google::Apis::BloggerV2 # Alias the module
service = Blogger::BloggerService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://blogger.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBloggerService

Returns a new instance of BloggerService.



47
48
49
50
51
52
# File 'lib/google/apis/blogger_v2/service.rb', line 47

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-blogger_v2',
        client_version: Google::Apis::BloggerV2::GEM_VERSION)
  @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.



40
41
42
# File 'lib/google/apis/blogger_v2/service.rb', line 40

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.



45
46
47
# File 'lib/google/apis/blogger_v2/service.rb', line 45

def quota_user
  @quota_user
end

Instance Method Details

#get_blog(blog_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::Blog

Gets a blog by id.

Parameters:

  • blog_id (String)
  • 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



73
74
75
76
77
78
79
80
81
# File 'lib/google/apis/blogger_v2/service.rb', line 73

def get_blog(blog_id, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/blogs/{blogId}', options)
  command.response_representation = Google::Apis::BloggerV2::Blog::Representation
  command.response_class = Google::Apis::BloggerV2::Blog
  command.params['blogId'] = blog_id unless blog_id.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_comment(blog_id, post_id, comment_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::Comment

Gets a comment by blog id, post id and comment id.

Parameters:

  • blog_id (String)
  • post_id (String)
  • comment_id (String)
  • 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



133
134
135
136
137
138
139
140
141
142
143
# File 'lib/google/apis/blogger_v2/service.rb', line 133

def get_comment(blog_id, post_id, comment_id, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/blogs/{blogId}/posts/{postId}/comments/{commentId}', options)
  command.response_representation = Google::Apis::BloggerV2::Comment::Representation
  command.response_class = Google::Apis::BloggerV2::Comment
  command.params['blogId'] = blog_id unless blog_id.nil?
  command.params['postId'] = post_id unless post_id.nil?
  command.params['commentId'] = comment_id unless comment_id.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_page(blog_id, page_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::Page

Gets a page by blog id and page id.

Parameters:

  • blog_id (String)
  • page_id (String)
  • 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



204
205
206
207
208
209
210
211
212
213
# File 'lib/google/apis/blogger_v2/service.rb', line 204

def get_page(blog_id, page_id, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/blogs/{blogId}/pages/{pageId}', options)
  command.response_representation = Google::Apis::BloggerV2::Page::Representation
  command.response_class = Google::Apis::BloggerV2::Page
  command.params['blogId'] = blog_id unless blog_id.nil?
  command.params['pageId'] = page_id unless page_id.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_post(blog_id, post_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::Post

Gets a post by blog id and post id

Parameters:

  • blog_id (String)
  • post_id (String)
  • 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



266
267
268
269
270
271
272
273
274
275
# File 'lib/google/apis/blogger_v2/service.rb', line 266

def get_post(blog_id, post_id, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/blogs/{blogId}/posts/{postId}', options)
  command.response_representation = Google::Apis::BloggerV2::Post::Representation
  command.response_class = Google::Apis::BloggerV2::Post
  command.params['blogId'] = blog_id unless blog_id.nil?
  command.params['postId'] = post_id unless post_id.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_user(user_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::User

Gets a user by user id.

Parameters:

  • user_id (String)
  • 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



333
334
335
336
337
338
339
340
341
# File 'lib/google/apis/blogger_v2/service.rb', line 333

def get_user(user_id, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/users/{userId}', options)
  command.response_representation = Google::Apis::BloggerV2::User::Representation
  command.response_class = Google::Apis::BloggerV2::User
  command.params['userId'] = user_id unless user_id.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_blogs(user_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::BlogList

Lists blogs by user id, possibly filtered.

Parameters:

  • user_id (String)
  • 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



102
103
104
105
106
107
108
109
110
# File 'lib/google/apis/blogger_v2/service.rb', line 102

def list_blogs(user_id, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/users/{userId}/blogs', options)
  command.response_representation = Google::Apis::BloggerV2::BlogList::Representation
  command.response_class = Google::Apis::BloggerV2::BlogList
  command.params['userId'] = user_id unless user_id.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_comments(blog_id, post_id, fetch_bodies: nil, max_results: nil, page_token: nil, start_date: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::CommentList

Lists comments.

Parameters:

  • blog_id (String)
  • post_id (String)
  • fetch_bodies (Boolean) (defaults to: nil)
  • max_results (Fixnum) (defaults to: nil)
  • page_token (String) (defaults to: nil)
  • start_date (String) (defaults to: nil)
  • 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



169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/google/apis/blogger_v2/service.rb', line 169

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)
  command = make_simple_command(:get, 'v2/blogs/{blogId}/posts/{postId}/comments', options)
  command.response_representation = Google::Apis::BloggerV2::CommentList::Representation
  command.response_class = Google::Apis::BloggerV2::CommentList
  command.params['blogId'] = blog_id unless blog_id.nil?
  command.params['postId'] = post_id unless post_id.nil?
  command.query['fetchBodies'] = fetch_bodies unless fetch_bodies.nil?
  command.query['maxResults'] = max_results unless max_results.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['startDate'] = start_date unless start_date.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_pages(blog_id, fetch_bodies: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::PageList

Lists pages.

Parameters:

  • blog_id (String)
  • fetch_bodies (Boolean) (defaults to: nil)
  • 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



235
236
237
238
239
240
241
242
243
244
# File 'lib/google/apis/blogger_v2/service.rb', line 235

def list_pages(blog_id, fetch_bodies: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/blogs/{blogId}/pages', options)
  command.response_representation = Google::Apis::BloggerV2::PageList::Representation
  command.response_class = Google::Apis::BloggerV2::PageList
  command.params['blogId'] = blog_id unless blog_id.nil?
  command.query['fetchBodies'] = fetch_bodies unless fetch_bodies.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_posts(blog_id, fetch_bodies: nil, max_results: nil, page_token: nil, start_date: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BloggerV2::PostList

Lists posts.

Parameters:

  • blog_id (String)
  • fetch_bodies (Boolean) (defaults to: nil)
  • max_results (Fixnum) (defaults to: nil)
  • page_token (String) (defaults to: nil)
  • start_date (String) (defaults to: nil)
  • 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



300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/google/apis/blogger_v2/service.rb', line 300

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)
  command = make_simple_command(:get, 'v2/blogs/{blogId}/posts', options)
  command.response_representation = Google::Apis::BloggerV2::PostList::Representation
  command.response_class = Google::Apis::BloggerV2::PostList
  command.params['blogId'] = blog_id unless blog_id.nil?
  command.query['fetchBodies'] = fetch_bodies unless fetch_bodies.nil?
  command.query['maxResults'] = max_results unless max_results.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['startDate'] = start_date unless start_date.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end