dj2 / ruby-postrank

Ruby PostRank Wrapper

This URL has Read+Write access

Joshua Hull (author)
Wed Jan 07 09:44:46 -0800 2009
dj2 (committer)
Sat Jan 10 08:02:41 -0800 2009
ruby-postrank / examples / api_example3.rb
100644 47 lines (33 sloc) 1.004 kb
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
require 'postrank'
 
conn = PostRank::Connection.instance
 
conn.appkey = 'everburning.com/test'
conn.app_secret = 'lkajds'
conn.app_token = 'asdf'
 
conn.user_secret = nil
conn.user_token = nil
 
# Needs to be done the first time the user accesses the API. save the secret/token somewhere
conn.authorization_url
conn.authorize
 
secret = conn.user_secret
token = conn.user_token
 
f = PostRank::Feed.find_by_url("http://everburning.com")
f2 = PostRank.Feed.find("ad409984854jk3830292390")
 
f.entries.each do |entry|
 puts entry.title
end
 
u = PostRank::User.current
puts u.email
puts u.id
 
s = PostRank::Subscription.new(...)
s.save
 
s = PostRank::Subscription.find(id)
s = PostRank::Subscription.find_by_id(id)
s = PostRank::Subscription.find_by_feed(feed)
 
s = PostRank::Subscription.find(:all)
 
c = PostRank::Channel.new(tag)
c.entries.each do |entry|
  puts entry.title
end
 
PostRank::PostRank.calculate([p1, p2, p3], [f1, f2, f3]).each do |feed, postrank, color|
 puts "#{feed} #{postrank} #{color}"
end