Class: Tumble::Blog

Inherits:
Object
  • Object
show all
Defined in:
lib/tumble/blog.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Blog) initialize(connection, name)



3
4
5
6
# File 'lib/tumble/blog.rb', line 3

def initialize(connection, name)
  @connection = connection
  @name = name
end

Instance Attribute Details

- (Object) name (readonly)

Returns the value of attribute name



8
9
10
# File 'lib/tumble/blog.rb', line 8

def name
  @name
end

Instance Method Details

- (Object) avatar(options = {})

You can get a blog's avatar in 9 different sizes. The default size is 64x64.

Options Hash (options):

  • :size (Integer)

    The size of the avatar. Must be in 16, 24, 30, 40, 48, 64, 96, 128, or 512

See Also:



26
27
28
# File 'lib/tumble/blog.rb', line 26

def avatar(options={})
  @connection.get("/blog/#{name}/avatar", options)
end

- (Object) create_post(options = {})

Create a New Blog Post

For text posts: For photo posts: For quote posts: For link posts: For chat posts: For audio posts: For video posts:

Options Hash (options):

  • :type (String)

    The type of post to create. Specify one of the following: text, photo, quote, link, chat, audio, video

  • :state (String)

    The state of the post. Specify one of the following: published, draft, queue

  • :tags (String)

    Comma-separated tags for this post

  • :tweet (String)

    Manages the autotweet (if enabled) for this post: set to off for no tweet, or enter text to override the default tweet

  • :date (String)

    The GMT date and time of the post, as a string

  • :markdown (Boolean)

    Indicates whether the post uses markdown syntax

  • :slug (String)

    Add a short text summary to the end of the post URL

  • :title (String)

    The optional title of the post, HTML entities must be escaped

  • :body (String)

    The full post body, HTML allowed

  • :caption (String)

    The user-supplied caption, HTML allowed

  • :link (String)

    The "click-through URL" for the photo

  • :source (String)

    The photo source URL

  • :data (Array)

    One or more image files (submit multiple times to create a slide show)

  • :quote (String)

    The full text of the quote, HTML entities must be escaped

  • :source (String)

    Cited source, HTML allowed

  • :title (String)

    The title of the page the link points to, HTML entities should be escaped

  • :url (String)

    The link

  • :description (String)

    A user-supplied description, HTML allowed

  • :title (String)

    The title of the chat

  • :conversation (String)

    The text of the conversation/chat, with dialogue labels (no HTML)

  • :caption (String)

    The user-supplied caption

  • :external_url (String)

    The URL of the site that hosts the audio file (not tumblr)

  • :data (String)

    An audio file

  • :caption (String)

    The user-supplied caption

  • :embed (String)

    HTML embed code for the video

  • :data (String)

    A video file

See Also:



123
124
125
# File 'lib/tumble/blog.rb', line 123

def create_post(options={})
  @connection.post("/blog/#{name}/post", options)
end

- (Object) delete_post(id)

Delete a Post



191
192
193
# File 'lib/tumble/blog.rb', line 191

def delete_post(id)
  @connection.post("/blog/#{name}/post/delete", :id => id)
end

- (Object) drafts

Retreive Draft Posts



72
73
74
# File 'lib/tumble/blog.rb', line 72

def drafts
  @connection.get("/blog/#{name}/posts/draft")
end

- (Object) edit_post(id, options = {})

Edit a Blog Post

For text posts: For photo posts: For quote posts: For link posts: For chat posts: For audio posts: For video posts:

Options Hash (options):

  • :type (String)

    The type of post to create. Specify one of the following: text, photo, quote, link, chat, audio, video

  • :state (String)

    The state of the post. Specify one of the following: published, draft, queue

  • :tags (String)

    Comma-separated tags for this post

  • :tweet (String)

    Manages the autotweet (if enabled) for this post: set to off for no tweet, or enter text to override the default tweet

  • :date (String)

    The GMT date and time of the post, as a string

  • :markdown (Boolean)

    Indicates whether the post uses markdown syntax

  • :slug (String)

    Add a short text summary to the end of the post URL

  • :title (String)

    The optional title of the post, HTML entities must be escaped

  • :body (String)

    The full post body, HTML allowed

  • :caption (String)

    The user-supplied caption, HTML allowed

  • :link (String)

    The "click-through URL" for the photo

  • :source (String)

    The photo source URL

  • :data (Array)

    One or more image files (submit multiple times to create a slide show)

  • :quote (String)

    The full text of the quote, HTML entities must be escaped

  • :source (String)

    Cited source, HTML allowed

  • :title (String)

    The title of the page the link points to, HTML entities should be escaped

  • :url (String)

    The link

  • :description (String)

    A user-supplied description, HTML allowed

  • :title (String)

    The title of the chat

  • :conversation (String)

    The text of the conversation/chat, with dialogue labels (no HTML)

  • :caption (String)

    The user-supplied caption

  • :external_url (String)

    The URL of the site that hosts the audio file (not tumblr)

  • :data (String)

    An audio file

  • :caption (String)

    The user-supplied caption

  • :embed (String)

    HTML embed code for the video

  • :data (String)

    A video file

See Also:



168
169
170
# File 'lib/tumble/blog.rb', line 168

def edit_post(id, options={})
  @connection.post("/blog/#{name}/post/edit", options.merge('id' => id))
end

- (Object) followers(options = {})

Retrieve a Blog's Followers

Options Hash (options):

  • :limit (Integer)

    The number of results to return: 1???20, inclusive

  • :offset (Integer)

    Result to start at

See Also:



38
39
40
# File 'lib/tumble/blog.rb', line 38

def followers(options={})
  @connection.get("/blog/#{name}/followers", options)
end

- (Object) info

This method returns general information about the blog, such as the title, number of posts, and other high-level data.



15
16
17
# File 'lib/tumble/blog.rb', line 15

def info
  @connection.get("/blog/#{name}/info")
end

- (Object) posts(options = {})

Retrieve Published Posts

Options Hash (options):

  • :type (String)

    The type of post to return. Specify one of the following: text, quote, link, answer, video, audio, photo

  • :id (Integer)

    A specific post ID. Returns the single post specified or (if not found) a 404 error.

  • :tag (String)

    Limits the response to posts with the specified tag

  • :limit (Integer)

    The number of posts to return: 1???20, inclusive

  • :offset (Integer)

    Post number to start at

  • :reblog_info (Boolean)

    Indicates whether to return reblog information (specify true or false). Returns the various reblogged_ fields.

  • :notes_info (Boolean)

    Indicates whether to return notes information (specify true or false). Returns note count and note metadata.

  • :format (String)

    Specifies the post format to return, other than HTML. Must be either text or raw.

See Also:



56
57
58
# File 'lib/tumble/blog.rb', line 56

def posts(options={})
  @connection.get("/blog/#{name}/posts", options)
end

- (Object) queue

Retrieve Queued Posts



64
65
66
# File 'lib/tumble/blog.rb', line 64

def queue
  @connection.get("/blog/#{name}/posts/queue")
end

- (Object) reblog_post(id, reblog_key, options = {})

Reblog a Post

Options Hash (options):

  • :comment (String)

    A comment added to the reblogged post

See Also:



181
182
183
# File 'lib/tumble/blog.rb', line 181

def reblog_post(id, reblog_key, options={})
  @connection.post("/blog/#{name}/post/reblog", options.merge('id' => id, 'reblog_key' => reblog_key))
end

- (Object) submissions

Retreive Submission Posts



80
81
82
# File 'lib/tumble/blog.rb', line 80

def submissions
  @connection.get("/blog/#{name}/posts/submission")
end