ActsAsTumblr
ActsAsTumblr works like a sponge absorbing all your Tumblr posts. It will retrieve posts as well as set up your routes for basic authentication. Currently, this works in one direction to retrieve posts. Posting to Tumblr will be built in future releases. This gem uses tumblr_client, acts-as-taggable-on, omniauth-tumblr, exportr, paperclip, and hashie. Very beta.
Requirements
- You are using Rails 3.1 or higher.
Installation
Add this to your gemfile:
gem 'acts_as_tumblr'
Run bundle install
.
Run rails generate acts_as_tumblr MODEL
The generator creates all migrations, controllers, and models.
Run rake db:migrate
Usage
ActsAsTumblr can be used to retrieve posts as well as capture them.
Retrieve
Post.fetch_all(["array", "of", "tags"], limit.to_i)
"fetch" can be used to define posts types.
Post.fetch_photos
Post.fetch_quotes
Tags and limit are completely optional.
Capture
posts = Post.fetch_all("nyc", "alldayeveryday")
posts.each do |p|
Post.capture(p, :photos => false)
end
"capture" will save the post. "options" is optional (ha!) but will allow you to control what is or isn't saved.
Post.capture(p, :stats => true)
:stats => true
will only save IDs and Note Count
Updating Note Counts
post.update_notes
"update_notes" will check to see if the post has attained new likes and reblogs. If if has, it will update on it's own.
Questions?
Write to [email protected].