File: simple_oauth.rb

package info (click to toggle)
ruby-simple-oauth 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 372 kB
  • sloc: ruby: 1,722; makefile: 4; sh: 4
file content (30 lines) | stat: -rw-r--r-- 1,000 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require_relative "simple_oauth/header"
require_relative "simple_oauth/version"

# OAuth 1.0 header generation and parsing library
#
# SimpleOAuth provides a simple interface for building and verifying
# OAuth 1.0 Authorization headers per RFC 5849.
#
# @example Building an OAuth header
#   header = SimpleOAuth::Header.new(
#     :get,
#     "https://api.example.com/resource",
#     {status: "Hello"},
#     consumer_key: "key",
#     consumer_secret: "secret"
#   )
#   header.to_s # => "OAuth oauth_consumer_key=\"key\", ..."
#
# @example Parsing an OAuth header
#   parsed = SimpleOAuth::Header.parse('OAuth oauth_consumer_key="key"')
#   # => {consumer_key: "key"}
#
# @see https://tools.ietf.org/html/rfc5849 RFC 5849 - The OAuth 1.0 Protocol
module SimpleOAuth
  # Error raised when parsing a malformed OAuth Authorization header
  class ParseError < StandardError; end

  # Error raised when invalid options are passed to Header
  # (defined in header.rb, exported here for convenience)
end