Class: Tumble::Blog
- Inherits:
-
Object
- Object
- Tumble::Blog
- Defined in:
- lib/tumble/blog.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#avatar(options = {}) ⇒ Object
You can get a blog’s avatar in 9 different sizes.
-
#create_post(options = {}) ⇒ Object
Create a New Blog Post.
-
#delete_post(id) ⇒ Object
Delete a Post.
-
#drafts ⇒ Object
Retreive Draft Posts.
-
#edit_post(id, options = {}) ⇒ Object
Edit a Blog Post.
-
#followers(options = {}) ⇒ Object
Retrieve a Blog’s Followers.
-
#info ⇒ Object
This method returns general information about the blog, such as the title, number of posts, and other high-level data.
-
#initialize(connection, name) ⇒ Blog
constructor
A new instance of Blog.
-
#posts(options = {}) ⇒ Object
Retrieve Published Posts.
-
#queue ⇒ Object
Retrieve Queued Posts.
-
#reblog_post(id, reblog_key, options = {}) ⇒ Object
Reblog a Post.
-
#submissions ⇒ Object
Retreive Submission Posts.
Constructor Details
#initialize(connection, name) ⇒ Blog
Returns a new instance of Blog.
3 4 5 6 |
# File 'lib/tumble/blog.rb', line 3 def initialize(connection, name) @connection = connection @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/tumble/blog.rb', line 8 def name @name end |
Instance Method Details
#avatar(options = {}) ⇒ Object
You can get a blog’s avatar in 9 different sizes. The default size is 64x64.
26 27 28 |
# File 'lib/tumble/blog.rb', line 26 def avatar(={}) @connection.get("/blog/#{name}/avatar", ).response end |
#create_post(options = {}) ⇒ Object
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:
123 124 125 |
# File 'lib/tumble/blog.rb', line 123 def create_post(={}) @connection.post("/blog/#{name}/post", ).response end |
#delete_post(id) ⇒ Object
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).response end |
#drafts ⇒ Object
Retreive Draft Posts
72 73 74 |
# File 'lib/tumble/blog.rb', line 72 def drafts @connection.get("/blog/#{name}/posts/draft").response end |
#edit_post(id, options = {}) ⇒ Object
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:
168 169 170 |
# File 'lib/tumble/blog.rb', line 168 def edit_post(id, ={}) @connection.post("/blog/#{name}/post/edit", .merge('id' => id)).response end |
#followers(options = {}) ⇒ Object
Retrieve a Blog’s Followers
38 39 40 |
# File 'lib/tumble/blog.rb', line 38 def followers(={}) @connection.get("/blog/#{name}/followers", ).response end |
#info ⇒ Object
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").response end |
#posts(options = {}) ⇒ Object
Retrieve Published Posts
56 57 58 |
# File 'lib/tumble/blog.rb', line 56 def posts(={}) @connection.get("/blog/#{name}/posts", ).response end |
#queue ⇒ Object
Retrieve Queued Posts
64 65 66 |
# File 'lib/tumble/blog.rb', line 64 def queue @connection.get("/blog/#{name}/posts/queue").response end |
#reblog_post(id, reblog_key, options = {}) ⇒ Object
Reblog a Post
181 182 183 |
# File 'lib/tumble/blog.rb', line 181 def reblog_post(id, reblog_key, ={}) @connection.post("/blog/#{name}/post/reblog", .merge('id' => id, 'reblog_key' => reblog_key)).response end |
#submissions ⇒ Object
Retreive Submission Posts
80 81 82 |
# File 'lib/tumble/blog.rb', line 80 def submissions @connection.get("/blog/#{name}/posts/submission").response end |