Skip to content

Commit 278a070

Browse files
committed
πŸ“ New README is ❀️‍πŸ”₯
Signed-off-by: Peter Boling <[email protected]>
1 parent 4f5da49 commit 278a070

File tree

4 files changed

+216
-91
lines changed

4 files changed

+216
-91
lines changed

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Added
99

1010
* Setup Rubocop (#205, #208 by @pboling)
11-
* Added CODE_OF_CONDUCT (#217 by @pboling)
11+
* Added CODE_OF_CONDUCT.md (#217, #218 by @pboling)
12+
* Added FUNDING.yml (#217, #218 by @pboling)
1213

1314
### Changed
1415

@@ -18,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1819
* Upgrade mocha to v1.13.0 (#193 by @pboling)
1920
* HISTORY renamed to CHANGELOG.md, and follows Keep a Changelog (#214, #215 by @pboling)
2021
* CHANGELOG, LICENSE, and README now ship with packaged gem (#214, #215 by @pboling)
22+
* README.rdoc renamed to README.md (#217, #218 by @pboling)
2123

2224
### Fixed
2325

@@ -26,7 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2628
* Fixed NoMethodError on nil request object (#165, #212 by @pboling)
2729
* Fixed Unsafe String Comparison (#156, #209 by @pboling and @drosseau)
2830
* Fixed typos in Gemspec (#204, #203, #208 by @pboling)
29-
* Copyright Notice in LICENSE - added correct years (#217 by @pboling)
31+
* Copyright Notice in LICENSE - added correct years (#217, #218 by @pboling)
3032

3133
### Removed
3234

β€ŽREADME.mdβ€Ž

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# Ruby OAuth
2+
3+
## Status
4+
5+
| Project | Ruby Oauth |
6+
|--------------------------- |--------------------------- |
7+
| name, license, docs | [![RubyGems.org](https://img.shields.io/badge/name-oauth-brightgreen.svg?style=flat)][rubygems] [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)][license-ref] [![RubyDoc.info](https://img.shields.io/badge/documentation-rubydoc-brightgreen.svg?style=flat)][documentation] |
8+
| version & downloads | [![Version](https://img.shields.io/gem/v/oauth.svg)][rubygems] [![Downloads Today](https://img.shields.io/gem/rd/oauth.svg)][rubygems] [![Homepage](https://img.shields.io/badge/source-github-brightgreen.svg?style=flat)][source] |
9+
| dependencies & linting | [![Depfu](https://badges.depfu.com/badges/d570491bac0ad3b0b65deb3c82028327/count.svg)][depfu] [![lint status](https://github.com/oauth-xx/oauth-ruby/actions/workflows/style.yml/badge.svg)][actions] |
10+
| unit tests | [![supported rubies](https://github.com/oauth-xx/oauth-ruby/actions/workflows/supported.yml/badge.svg)][actions] [![unsupported status](https://github.com/oauth-xx/oauth-ruby/actions/workflows/unsupported.yml/badge.svg)][actions] |
11+
| coverage & maintainability | [![Test Coverage](https://api.codeclimate.com/v1/badges/3cf23270c21e8791d788/test_coverage)][climate_coverage] [![codecov](https://codecov.io/gh/oauth-xx/oauth-ruby/branch/master/graph/badge.svg?token=4ZNAWNxrf9)][codecov_coverage] [![Maintainability](https://api.codeclimate.com/v1/badges/3cf23270c21e8791d788/maintainability)][climate_maintainability] |
12+
| resources | [![Discussion](https://img.shields.io/badge/discussions-github-brightgreen.svg?style=flat)][gh_discussions] [![Mailing List](https://img.shields.io/badge/group-mailinglist-violet.svg?style=social&logo=google)][mailinglist] [![Join the chat at https://gitter.im/oauth-xx/oauth-ruby](https://badges.gitter.im/Join%20Chat.svg)][chat] [![Blog](https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat)][blogpage] |
13+
| Spread ~β™‘β“›β“žβ“₯β“”β™‘~ | [![Open Source Helpers](https://www.codetriage.com/oauth-xx/oauth-ruby/badges/users.svg)][code_triage] [![Liberapay Patrons](https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay)][liberapay_donate] [🌏][aboutme] [πŸ‘Ό][angelme] [πŸ’»][coderme] [🌹][politicme] [![Tweet @ Peter][followme-img]][tweetme] |
14+
15+
## What
16+
17+
This is a RubyGem for implementing both OAuth 1.0 clients and servers in Ruby
18+
applications.
19+
20+
See the OAuth 1.0 spec http://oauth.net/core/1.0/
21+
22+
See the sibling gem [oauth2](https://github.com/oauth-xx/oauth2) for OAuth 2.0 implementations in Ruby.
23+
24+
## Installation
25+
26+
Add this line to your application's Gemfile:
27+
28+
```ruby
29+
gem "oauth"
30+
```
31+
32+
And then execute:
33+
34+
$ bundle install
35+
36+
Or install it yourself as:
37+
38+
$ gem install oauth
39+
40+
## Compatibility
41+
42+
Targeted ruby compatibility is non-EOL versions of Ruby, currently 2.6, 2.7, and
43+
3.0. Ruby is limited to 2.0+ in the gemspec, and this may change while the gem is
44+
still at version 0.x.
45+
46+
## Basics
47+
48+
This is a ruby library which is intended to be used in creating Ruby Consumer
49+
and Service Provider applications. It is NOT a Rails plugin, but could easily
50+
be used for the foundation for such a Rails plugin.
51+
52+
As a matter of fact it has been pulled out from an OAuth Rails GEM
53+
(https://rubygems.org/gems/oauth-plugin https://github.com/pelle/oauth-plugin)
54+
which now uses this gem as a dependency.
55+
56+
## Usage
57+
58+
We need to specify the oauth_callback url explicitly, otherwise it defaults to
59+
"oob" (Out of Band)
60+
61+
callback_url = "http://127.0.0.1:3000/oauth/callback"
62+
63+
Create a new `OAuth::Consumer` instance by passing it a configuration hash:
64+
65+
oauth_consumer = OAuth::Consumer.new("key", "secret", :site => "https://agree2")
66+
67+
Start the process by requesting a token
68+
69+
request_token = oauth_consumer.get_request_token(:oauth_callback => callback_url)
70+
71+
session[:token] = request_token.token
72+
session[:token_secret] = request_token.secret
73+
redirect_to request_token.authorize_url(:oauth_callback => callback_url)
74+
75+
When user returns create an access_token
76+
77+
hash = { oauth_token: session[:token], oauth_token_secret: session[:token_secret]}
78+
request_token = OAuth::RequestToken.from_hash(oauth_consumer, hash)
79+
access_token = request_token.get_access_token
80+
# For 3-legged authorization, flow oauth_verifier is passed as param in callback
81+
# access_token = request_token.get_access_token(oauth_verifier: params[:oauth_verifier])
82+
@photos = access_token.get('/photos.xml')
83+
84+
Now that you have an access token, you can use Typhoeus to interact with the
85+
OAuth provider if you choose.
86+
87+
require 'typhoeus'
88+
require 'oauth/request_proxy/typhoeus_request'
89+
oauth_params = {:consumer => oauth_consumer, :token => access_token}
90+
hydra = Typhoeus::Hydra.new
91+
req = Typhoeus::Request.new(uri, options) # :method needs to be specified in options
92+
oauth_helper = OAuth::Client::Helper.new(req, oauth_params.merge(:request_uri => uri))
93+
req.options[:headers].merge!({"Authorization" => oauth_helper.header}) # Signs the request
94+
hydra.queue(req)
95+
hydra.run
96+
@response = req.response
97+
98+
## More Information
99+
100+
* RubyDoc Documentation: [![RubyDoc.info](https://img.shields.io/badge/documentation-rubydoc-brightgreen.svg?style=flat)][documentation]
101+
* Mailing List/Google Group: [![Mailing List](https://img.shields.io/badge/group-mailinglist-violet.svg?style=social&logo=google)][mailinglist]
102+
* GitHub Discussions: [![Discussion](https://img.shields.io/badge/discussions-github-brightgreen.svg?style=flat)][gh_discussions]
103+
* Live Chat on Gitter: [![Join the chat at https://gitter.im/oauth-xx/oauth-ruby](https://badges.gitter.im/Join%20Chat.svg)][chat]
104+
* Maintainer's Blog: [![Blog](https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat)][blogpage]
105+
106+
## Contributing
107+
108+
Bug reports and pull requests are welcome on GitHub at [https://github.com/oauth-xx/oauth-ruby][source]. This project is
109+
intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
110+
the [code of conduct][conduct].
111+
112+
To submit a patch, please fork the oauth project and create a patch with
113+
tests. Once you're happy with it send a pull request and post a message to the
114+
[google group][mailinglist].
115+
116+
## Contributors
117+
118+
[![Contributors](https://contrib.rocks/image?repo=oauth-xx/oauth-ruby)]("https://github.com/oauth-xx/oauth-ruby/graphs/contributors")
119+
120+
Made with [contributors-img](https://contrib.rocks).
121+
122+
## Versioning
123+
124+
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations of this scheme should be reported as
125+
bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be
126+
immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new
127+
major versions.
128+
129+
As a result of this policy, you can (and should) specify a dependency on this gem using
130+
the [Pessimistic Version Constraint][pvc] with two digits of precision.
131+
132+
For example:
133+
134+
```ruby
135+
spec.add_dependency "oauth", "~> 0.5"
136+
```
137+
138+
## License
139+
140+
The gem is available as open source under the terms of
141+
the [MIT License][license] [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)][license-ref].
142+
See [LICENSE][license] for the [Copyright Notice][copyright-notice-explainer].
143+
144+
## Contact
145+
146+
OAuth Ruby has been created and maintained by a large number of talented
147+
individuals. The current maintainer is Peter Boling ([@pboling][gh_sponsors]).
148+
149+
Comments are welcome. Contact the [OAuth Ruby mailing list (Google Group)][mailinglist] or [GitHub Discussions][gh_discussions].
150+
151+
[copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
152+
153+
[gh_discussions]: https://github.com/oauth-xx/oauth-ruby/discussions
154+
155+
[mailinglist]: http://groups.google.com/group/oauth-ruby
156+
157+
[conduct]: https://github.com/oauth-xx/oauth-ruby/blob/master/CODE_OF_CONDUCT.md
158+
159+
[license]: LICENSE
160+
161+
[license-ref]: https://opensource.org/licenses/MIT
162+
163+
[semver]: http://semver.org/
164+
165+
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
166+
167+
[railsbling]: http://www.railsbling.com
168+
169+
[peterboling]: http://www.peterboling.com
170+
171+
[aboutme]: https://about.me/peter.boling
172+
173+
[angelme]: https://angel.co/peter-boling
174+
175+
[coderme]:http://coderwall.com/pboling
176+
177+
[followme-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
178+
179+
[tweetme]: http://twitter.com/galtzo
180+
181+
[politicme]: https://nationalprogressiveparty.org
182+
183+
[documentation]: https://rubydoc.info/github/oauth-xx/oauth-ruby/main
184+
185+
[source]: https://github.com/oauth-xx/oauth-ruby/
186+
187+
[actions]: https://github.com/oauth-xx/oauth-ruby/actions
188+
189+
[issues]: https://github.com/oauth-xx/oauth-ruby/issues
190+
191+
[climate_maintainability]: https://codeclimate.com/github/oauth-xx/oauth-ruby/maintainability
192+
193+
[climate_coverage]: https://codeclimate.com/github/oauth-xx/oauth-ruby/test_coverage
194+
195+
[codecov_coverage]: https://codecov.io/gh/oauth-xx/oauth-ruby
196+
197+
[code_triage]: https://www.codetriage.com/oauth-xx/oauth-ruby
198+
199+
[depfu]: https://depfu.com/github/oauth-xx/oauth-ruby?project_id=22868
200+
201+
[blogpage]: http://www.railsbling.com/tags/oauth/
202+
203+
[rubygems]: https://rubygems.org/gems/oauth
204+
205+
[chat]: https://gitter.im/oauth-xx/oauth-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
206+
207+
[maintenancee_policy]: https://guides.rubyonrails.org/maintenance_policy.html#security-issues
208+
209+
[liberapay_donate]: https://liberapay.com/pboling/donate
210+
211+
[gh_sponsors]: https://github.com/sponsors/pboling

β€ŽREADME.rdocβ€Ž

Lines changed: 0 additions & 88 deletions
This file was deleted.

β€Žoauth.gemspecβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
2323
"homepage_uri" => spec.homepage,
2424
"source_code_uri" => spec.homepage
2525
}
26-
spec.files = Dir.glob("lib/**/*.rb") + ["LICENSE", "README.rdoc", "CHANGELOG.md", "CODE_OF_CONDUCT.md"]
26+
spec.files = Dir.glob("lib/**/*.rb") + ["LICENSE", "README.md", "CHANGELOG.md", "CODE_OF_CONDUCT.md"]
2727
spec.extra_rdoc_files = [ "TODO" ]
2828

2929
# This gem will work with Ruby 2.0 or greater...

0 commit comments

Comments
Β (0)