Posting to the most popular social media from Ruby
Switch branches/tags
Nothing to show
Clone or download
Latest commit cdd93f2 Aug 17, 2018
Permalink
Failed to load latest commit information.
.circleci migrate to circle 2.0 Aug 17, 2018
bin postwill gem Oct 29, 2017
lib bump version Nov 11, 2017
spec postwill gem Oct 29, 2017
.gitignore Added instagram (#9) Oct 25, 2017
.rspec add circle Aug 31, 2017
.rubocop.yml Merge pull request #2 from kirillshevch/improvement/dev-tools Aug 31, 2017
Gemfile postwill gem Oct 29, 2017
LICENSE.txt init social_posting Aug 31, 2017
PROVIDERS.md tumblr settings Oct 30, 2017
README.md add badges Oct 29, 2017
Rakefile add dev tools Aug 31, 2017
postwill.gemspec authorship Nov 11, 2017

README.md

Postwill

Gem Version CircleCI Maintainability

Posting to the most popular social media

Installation

Add this line to your application's Gemfile:

gem 'postwill'

And then execute:

$ bundle

Or install it yourself as:

$ gem install postwill

Usage

List of available providers is here.

Single provider

postwill = Postwill::Client.new(
                   twitter: {
                     access_token: 'access_token',
                     access_token_secret: 'access_token_secret'
                   }
                 )

postwill.to(:twitter, text: 'text', image: 'image')

Success:

{
  twitter: {
    status: :ok,
    response: {} # Hash of response data depends on provider
  }
}

Failure:

{
  twitter: {
    status: :error,
    response: '' # String error message
  }
}

Application credentials

config/initializers/postwill.rb

Postwill::Settings.configure do |config|
  config.providers.twitter = {
    consumer_key: 'your_consumer_key',
    consumer_secret: 'your_consumer_secret'
  }
end

Multiple providers

postwill = Postwill::Client.new(
                   twitter: {
                     access_token: 'access_token',
                     access_token_secret: 'access_token_secret'
                   },
                   facebook: {
                     access_token: 'access_token'
                   }
                 )

postwill.to(%i[twitter facebook], text: 'text', image: 'image')

Result:

{
  twitter: {
    status: :ok,
    response: {} # Response data
  },
  facebook: {
    status: :ok,
    response: {} # Response data
  }
}

Application credentials(for providers which need them)

config/initializers/postwill.rb

Postwill::Settings.configure do |config|
  config.providers.twitter = {
    consumer_key: 'your_consumer_key',
    consumer_secret: 'your_consumer_secret'
  }
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/postwill/postwill.

License

The gem is available as open source under the terms of the MIT License.