File: README.rdoc

package info (click to toggle)
ruby-webfinger 2.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 168 kB
  • sloc: ruby: 401; makefile: 7
file content (76 lines) | stat: -rw-r--r-- 2,112 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
= WebFinger

An Ruby WebFinger client library.

Following the latest WebFinger spec discussed at IETF WebFinger WG.
http://tools.ietf.org/html/draft-ietf-appsawg-webfinger

If you found something different from the latest spec, open an issue please.

== Installation

Add this line to your application's Gemfile:

  gem 'webfinger'

And then execute:

  $ bundle

Or install it yourself as:

  $ gem install webfinger

== Usage

=== Basic

You can discover resource metadata.

  WebFinger.discover! 'acct:nov@connect-op.heroku.com'
  WebFinger.discover! 'connect-op.heroku.com'
  WebFinger.discover! 'http://connect-op.heroku.com'

You can also specify link relations via "rel" option.

  WebFinger.discover! 'acct:nov@connect-op.heroku.com', rel: 'http://openid.net/specs/connect/1.0/issuer'
  WebFinger.discover! 'acct:nov@connect-op.heroku.com', rel: ['http://openid.net/specs/connect/1.0/issuer', 'vcard']

=== Caching

Caching is important in HTTP-based discovery.

If you set your own cache object to <code>WebFinger.cache</code>, this gem caches the discovery result until it expires.
(the expiry is calculated based on the "expires" value in JRD response)

  # Set Cache
  WebFinger.cache = Rails.cache

  WebFinger.discover! 'acct:nov@connect-op.heroku.com' # do HTTP request
  WebFinger.discover! 'acct:nov@connect-op.heroku.com' # use cache, no HTTP request

=== Debugging

Once you turn-on debugging, you can see all HTTP request/response in your log.

  # Turn on debugging
  WebFinger.debug!

  # Set logger (OPTIONAL, ::Logger.new(STDOUT) is used as default)
  WebFinger.logger = Rails.logger

You can also specify URL builder to force non-HTTPS access. (NOTE: allow non-HTTPS access only for debugging, not on your production.)

  WebFinger.url_builder = URI::HTTP # default URI::HTTPS

== Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

== Copyright

Copyright (c) 2012 nov matake. See LICENSE for details.