Skip to content

t0ggah/mingle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mingle

Gem Version Build Status Dependency Status Code Climate Coverage Status

Mingle makes it really easy to syndicate tweets from Twitter and photos from Instagram in your Ruby on Rails application.

Installation

Add this line to your application's Gemfile:

gem 'mingle'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mingle

Install the migrations:

rake mingle:install:migrations

Run the migrations:

rake db:migrate

Usage

# Create some hashtags to syndicate content from
Mingle::Hashtag.create tag_name: "#hyper"

# Fetch tweets from Twitter
Mingle::Twitter.fetch

# Fetch photos from Instagram
Mingle::Instagram.fetch

Mingle also ships with rake tasks:

$ rake mingle:twitter:fetch
$ rake mingle:instagram:fetch

Jobs

Mingle ships with Sidekiq jobs for your perusal.

Configuration

Mingle is configured through Mingle.configure, like this:

Mingle.configure do |config|
  config.twitter_api_key = ENV['TWITTER_API_KEY']
  # ...
end

You can also configure it temporarily:

Mingle.temporarily twitter_api_key: 'ABC123' do
  # ...
end

The following configurations can be made through Mingle.configure:

  • twitter_api_key - A Twitter application's API key.
  • twitter_api_secret - A Twitter application's API secret.
  • twitter_access_token - A Twitter application's access token.
  • twitter_access_token_secret - A Twitter application's access token secret.
  • instagram_client_id - An Instagram application's client id.
  • since - A date before which posts, tweets and photos will be ignored.

Note: We recommend you store your application configuration in your environment, like in the example above. In fact, we recommend it so much that Mingle will automatically look for environment variables with specific names, unless you configure them through Mingle.configure.

Mingle checks for following environment variables by default:

  • TWITTER_API_KEY - the equivalent of twitter_api_key
  • TWITTER_API_SECRET - the equivalent of twitter_api_secret
  • TWITTER_ACCESS_TOKEN - the equivalent of twitter_access_token
  • TWITTER_ACCESS_TOKEN_SECRET - the equivalent of twitter_access_token_secret
  • INSTAGRAM_CLIENT_ID - the equivalent of instagram_client_id

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Credits

Hyper made this. We're a digital communications agency with a passion for good code, and if you're using this library we probably want to hire you.

License

Mingle is available under the MIT license. See the LICENSE file for more info.

About

Social media integration for Ruby on Rails

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 90.9%
  • HTML 7.2%
  • Other 1.9%