GithubHelp home page GithubHelp logo

twttr's Introduction

Twttr

Twitter API v2 Interface

example workflow Gem Version Coverage Status Maintainability

Summery

Modular Twitter API interface, initially targeting Twitter API v2

Examples

Config

# Creating a Client using OAuth 1.0a User context
client = Twttr::Client.new(user_id) do |config|
  # App credentials
  config.consumer_key        = "consumer_key"
  config.consumer_secret     = "consumer_secret"

  # User credentials
  config.access_token        = "access_token"
  config.access_token_secret = "access_secret"

  # Default user fields
  # https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user
  config.user_fields         = %w(id, name, username)
end #=> #<Twttr::Client>

Client

# Twttr::Client#me
client.me #=> #<Twttr::Model::User>

#Twttr::Client#user(:user_id)
client.user("user_id") #=> #<Twttr::Model::User>

#Twttr::Client#user_by_username(:username)
client.user_by_username("username") #=> #<Twttr::Model::User>

#Twttr::Client#users(:user_ids)
client.users(["user_id_1", "user_id_2"]) #=> [#<Twttr::Model::User>]

# Twttr::Client#Followers
client.followers("user_id") == client.user("user_id").followers

# Twttr::Client#Following
client.following("user_id") == client.user("user_id").following

User

# Twttr::Model::User#followers
#
# Yields each page of users
user.followers do |users, pagination_token|
  users #=> [#<Twttr::Model::User>]
end #=> [#<Twttr::Model::User>]

# Follower users
user.followers #=> [#<Twttr::Model::User>]

# Twttr::Model::User#following
#
# Yields each page of users
user.following do |users, pagination_token|
  users #=> [#<Twttr::Model::User>]
end #=> [#<Twttr::Model::User>]

# Followed users
user.following #=> [#<Twttr::Model::User>]

Implemented Endpoints

Authentication

Type Initial Release Implemented?
OAuth 1.0a v0.0.5
OAuth 2.0 - -

Users

Users Lookup

Endpoint Initial Release Implemented?
GET /2/users v0.0.5
GET /2/users/:id v0.0.5
GET /2/users/by v0.0.6
GET /2/users/by/username/:username v0.0.5
GET /2/users/me v0.0.5

Follows

Endpoint Initial Release Implemented?
GET /2/users/:id/following v0.0.5
GET /2/users/:id/followers v0.0.6
POST /2/users/:id/following - -
DELETE /2/users/:source_user_id/following/:target_user_id - -

twttr's People

Contributors

robertodecurnex avatar toothlesspanda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.