Socket
Book a DemoInstallSign in
Socket

oauth-client

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oauth-client

0.1.0
bundlerRubygems
Version published
Maintainers
3
Created
Source

h1. Generic OAuth Client for Ruby, based on moomerman/twitter_oauth

NOTE: This is a very early version and has not been tested, give it some time :)

This is a core OAuth Client, extracting core elements from the an awesome moomerman/twitter_oauth gem and reorganizing them to give you tools to build your own client for an API of choice. This gem can be used to jump-start your new OAuth client.

Example:

require 'oauth_client'	
class TwitterOAuth < OAuthClient::Client
  site 'http://twitter.com'
end

That's all you need to have a working OAuth client which you can use to authorize with an OAuth server. Of course, it won't do anything just yet :) You need to implement specific methods for the API you're working with.

You have a few helper methods to ease the trouble. OAuthClient#get and OAuthClient#post return the unparsed response from the server. It includes an adapter for JSON, which will parse the response prior to returning it. To use it, call OAuthClient#json.get or OAuthClient#json.post.

See this example from moomerman/twitter_oauth:

module TwitterOauth
  class Client
    [...]
    def user(page=1)
      oauth_response = access_token.get("/statuses/user_timeline.json?page=#{page}")
      JSON.parse(oauth_response.body)
    end
		[...]
  end
end

with OAuthClient, it would look like this:

require 'oauth_client'	
class TwitterOAuth < OAuthClient::Client
  site 'http://twitter.com'

  def user(page=1)
    json.get("/statuses/user_timeline.json?page=#{page}")
  end
end

h2. Authors

This gem has been built by hacking and modifing the twitter_oauth gem by Richard Taylor (http://github.com/moomerman). The core client authorization structure is taken from there.

Banged together by Marcin Bunsch (http://github.com/marcinbunsch).

FAQs

Package last updated on 08 Nov 2009

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.