Project

weibo_api

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for the Weibo API v2.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 0.16
 Project Readme

WeiboApi

A Ruby wrapper for the Weibo API.

Installation

Add this line to your application's Gemfile:

gem 'weibo_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install weibo_api

Usage

config/initializers/weibo_api.rb

WeiboApi.configure do |config|
  config.client_id = ENV['weibo_client_id']
  config.client_secret = ENV['weibo_client_secret']
end

All methods return a hash

    # the access_token and the uid can be find with the omniauth gem https://github.com/beenhero/omniauth-weibo-oauth2
    weibo_user = WeiboApi::User.new(access_token, uid)
    
    # get the user info
    weibo_user.info
    
    # get the lastest weibos of the user
    weibo_user.timeline

    # or just find one specific
    weibo_user.show_status(weibo_id)
    
    # do a custom search
    weibo_user.custom_request('/comments/to_me')

Methods can take parameters (available on the official documentation)

    weibo_user.timeline(page: pages_count, since_id: starting_id)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ocarta-l/weibo_api.

License

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