A ruby interface for the Mastodon API
Luiz Picolo ツ 60b0ed09c3 Added new instruction to usage (#48) | 4 éve | |
---|---|---|
.github | 4 éve | |
lib | 4 éve | |
spec | 4 éve | |
.codeclimate.yml | 8 éve | |
.gitignore | 5 éve | |
.rspec | 8 éve | |
.rubocop.yml | 7 éve | |
.travis.yml | 5 éve | |
CHANGELOG.md | 5 éve | |
Gemfile | 8 éve | |
README.md | 4 éve | |
Rakefile | 8 éve | |
mastodon.gemspec | 5 éve |
A ruby interface for the Mastodon API.
gem 'mastodon-api', require: 'mastodon'
All the documentation is available on RubyDoc.
Assuming that you already have an access token for a user on a given Mastodon instance:
require 'mastodon'
client = Mastodon::REST::Client.new(base_url: 'https://mastodon.social', bearer_token: 'your_access_token')
If you need to get an access token, you must first ensure that you have the client ID and client secret for your app on the given Mastodon instance (you should save those for future calls):
client.create_app('My Ruby App', 'http://mywebsite.com/callback')
You can then use the client ID and secret in a standard OAuth 2 authorization flow.