Notice: Croudia has shut down since Dec 31, 2017. This rubygem will no longer work as it depends on Croudia's API.
Croudia
Ruby wrapper for the Croudia API
This software is not affiliated with Croudia Inc. Croudia is a registered trademark of Croudia Inc. in Japan.
Installation
Add this line to your application's Gemfile:
gem "croudia", "~> 1.0"
And then execute:
$ bundle
Or install it yourself as:
$ gem install croudia
Usage
Getting an access token
require "croudia"
# Initialize a new instance
croudia = Croudia::Client.new(
client_id: "client_id",
client_secret: "client_secret"
)
# Get URL
url = croudia.authorize_url
# Or add state query in URL
url = croudia.authrorize_url(state: "state_value")
# Retrieve an access token
access_token = croudia.get_access_token("code param returned by user")
#=> { "access_token" => " ... ", "refresh_token" => " ... ", ... }
# Refresh an access token
new_access_token = croudia.get_access_token(
grant_type: :refresh_token,
refresh_token: "refresh_token"
)
Using the API
require "croudia"
# Create an instance
croudia = Croudia::Client.new(access_token: "access_token")
# Get home_timeline
home_timeline = croudia.home_timeline
# Post a status
posted_status = croudia.update("Hello!")
The full documentation of Croudia::Client
is available at:
http://rdoc.info/gems/croudia/Croudia/Client
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request