titi 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -36,13 +36,18 @@ module Titi
36
36
  end
37
37
  end
38
38
 
39
- Feed = Struct.new(
39
+ class ActivityStreamsStruct < ActivityStreamsStruct
40
+ def self.new *args, &block
41
+ super
42
+ include Titi::Adaptor
43
+ include Titi::Provider::ActivityStreams::Common
44
+ end
45
+ end
46
+
47
+ Feed = ActivityStreamsStruct.new(
40
48
  :entry
41
49
  )
42
50
  Feed.class_eval do
43
- include Titi::Adaptor
44
- include Titi::Provider::ActivityStreams::Common
45
-
46
51
  def adapt thingys
47
52
  self.entry = thingys.map do |thingy|
48
53
  thingy.to_activity_stream_entry
@@ -52,7 +57,7 @@ module Titi
52
57
 
53
58
  # An ActivityStream entry
54
59
  # http://activitystrea.ms/spec/1.0/atom-activity-01.html#activityentries
55
- Entry = Struct.new(
60
+ Entry = ActivityStreamsStruct.new(
56
61
  :id, # ???
57
62
  :title, # title
58
63
  :content, # content
@@ -61,7 +66,7 @@ module Titi
61
66
  :updated, # date updated
62
67
  #
63
68
  :category, # type of entry
64
- :verb, # action it implies
69
+ :activity_verb, # action it implies:
65
70
  :sync, # sync
66
71
  :rank, # rank
67
72
  #
@@ -73,8 +78,6 @@ module Titi
73
78
  :target # target
74
79
  )
75
80
  Entry.class_eval do
76
- include Titi::Adaptor
77
- include Titi::Provider::ActivityStreams::Common
78
81
  def published= date_time
79
82
  self[:published] = DateTime.parse(date_time) rescue nil
80
83
  end
@@ -83,22 +86,43 @@ module Titi
83
86
  end
84
87
  end
85
88
 
89
+ # <link href="http://twitter.com/banksean/statuses/12244282580"
90
+ # type="text/xhtml" rel="via" title="Just saw a @cliqset #salmon @-mention interop demo by @jpanzer. Very neat stuff!">
91
+ # </link>
92
+
93
+ Link = ActivityStreamsStruct.new(
94
+ :href,
95
+ :title,
96
+ :rel,
97
+ :type
98
+ )
99
+ Link.class_eval do
100
+ end
101
+
102
+ Address = ActivityStreamsStruct.new(
103
+ :country,
104
+ :locality,
105
+ :postalCode,
106
+ #
107
+ :xml_keys # for debugging, capture the keys from the raw XML hash
108
+ )
109
+ Address.class_eval do
110
+ end
111
+
86
112
  # ActivityStream author
87
113
  # http://activitystrea.ms/spec/1.0/atom-activity-01.html#activityactor
88
- Actor = Struct.new(
114
+ Actor = ActivityStreamsStruct.new(
89
115
  :name,
90
116
  :uri
91
117
  )
92
118
  Actor.class_eval do
93
- include Titi::Adaptor
94
- include Titi::Provider::ActivityStreams::Common
95
119
  end
96
120
  Author = Actor
97
121
 
98
122
  # ActivityStream object.
99
123
  # We can't call them 'Object' (ruby has a class like that already :)
100
124
  # http://activitystrea.ms/spec/1.0/atom-activity-01.html#activityobjectelement
101
- Obj = Struct.new(
125
+ Obj = ActivityStreamsStruct.new(
102
126
  :id,
103
127
  :title,
104
128
  :content,
@@ -107,12 +131,10 @@ module Titi
107
131
  :updated,
108
132
  #
109
133
  :author,
110
- :object_type,
134
+ :object_type, # video, post, file
111
135
  :vevent
112
136
  )
113
137
  Obj.class_eval do
114
- include Titi::Adaptor
115
- include Titi::Provider::ActivityStreams::Common
116
138
  end
117
139
  end
118
140
  end
@@ -0,0 +1,16 @@
1
+
2
+
3
+ * checkins
4
+ * NOAA weather advisories, earthquake feeds, weather warning
5
+ *
6
+ * server monitoring
7
+ * github commits
8
+
9
+
10
+ "streaming data" vs "reference data"
11
+
12
+
13
+ * Mood:
14
+ - myspace, livejournal, im clients -- is this an object or an attribute
15
+ - the telecom
16
+ * annotations:
@@ -0,0 +1,48 @@
1
+ h2. Delicious Blog
2
+
3
+ * http://feeds.delicious.com/v2/rss/seldo?count=15 vs http://api.cliqset.com/feed/?svcuser=seldo&feedid=deliciousbookmarksposted
4
+
5
+ title type="text"
6
+ id
7
+ entry xmlns:service="http://activitystrea.ms/service-provider" xmlns:activity="http://activitystrea.ms/spec/1.0/"
8
+ activity:verb post
9
+ id item.guid
10
+ published item.pubDate
11
+ updated [whatever]
12
+ title item.title
13
+ summary item.description
14
+ link_alt
15
+ link_enclosure
16
+ link_preview
17
+ link_related item.link
18
+ link_self
19
+ author
20
+ name item.dc:creator{ CDATA }
21
+ uri channel.link
22
+ link_photo
23
+ activity:object
24
+ activity:object-type :bookmark
25
+ title item.title
26
+ summary item.description
27
+ link_alt item.guid isPermaLink="false"
28
+ link_enclosure
29
+ link_preview /generated/
30
+ link_related item.link
31
+ published
32
+ generator
33
+ media:description
34
+
35
+ generator
36
+ name 'delicious'
37
+ uri 'http://delicious.com'
38
+ icon 'http://cliqset-services.s3.amazonaws.com/delicious.png'
39
+
40
+ category [item.category]
41
+
42
+ thr:total
43
+ thr:in_reply_to
44
+ reply
45
+
46
+ NOTES:
47
+
48
+ * alt and related are backwards: can we have another rel=canonical, or nominate of the links as 'main'
@@ -0,0 +1,87 @@
1
+ h2. Flickr Photos
2
+
3
+ <pre><code>
4
+ id id
5
+ published published
6
+ title title
7
+
8
+ generator 'flickr', flickr.com, feed.icon (optional) [was service:provider]
9
+ summary ...
10
+ content /same/
11
+ author
12
+ name entry.author.name
13
+ uri uri
14
+ id flickr_nsid
15
+ link { rel=photo from flickr_buddyicon }
16
+
17
+ activity:verb ..
18
+
19
+ category tags
20
+
21
+ atom:source
22
+ id .
23
+ title .
24
+ link_alt .
25
+ updated .
26
+
27
+ verb :post
28
+
29
+ activity:actor
30
+
31
+ activity:object
32
+ id atom:entry id
33
+ title .
34
+ summary .
35
+ content .
36
+ link_alt type="text/html" rel="alt"
37
+ link_enclosure type="image/jpeg" rel="enclosure" [this is derived by another call]
38
+ link_preview type="image/jpeg" rel="preview" [this is derived by another call]
39
+ published
40
+ generator
41
+ activity:object_type .
42
+ media:description
43
+
44
+ thr:in_reply_to
45
+ rel
46
+ href
47
+
48
+ </code></pre>
49
+
50
+ NOTES:
51
+ * entry link rel alt is missing in orginal
52
+
53
+
54
+ h2. Flickr Favorites
55
+
56
+ * http://api.cliqset.com/feed/?svcuser=25419820@N00&feedid=flickrmediafavorited
57
+
58
+ title type="text"
59
+ id
60
+ entry xmlns:service="http://activitystrea.ms/service-provider" xmlns:activity="http://activitystrea.ms/spec/1.0/"
61
+ id guid
62
+ published pubDate
63
+ updated [discretionary]
64
+ link item.link href="http://www.flickr.com/photos/davelawrence8/3663647101/"
65
+ title item.title type="text"
66
+ summary item.description type="html"
67
+ author
68
+ name channel.title
69
+ activity:verb 'favorite'
70
+ activity:object xmlns:media="http://purl.org/syndication/atommedia"
71
+ title type="text"
72
+ summary .
73
+ activity:object-type .
74
+ summary item.description
75
+ media:description item.media_description type="text"
76
+ link rel="preview" type="image/jpeg" href="" media:height="" media:width=""
77
+ link rel="enclosure" type="image/jpeg" href="" media:height="" media:width=""
78
+ link rel="alternate" type="text/html" href=""
79
+ generator
80
+ name 'flickr'
81
+ uri .
82
+ icon .
83
+ activity:actor
84
+ activity:object-type .
85
+ title type="text"
86
+ category
87
+ [parse the words into category objects]
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,50 @@
1
+ module Titi::Provider
2
+ module GenericRss
3
+
4
+ class Feed
5
+ attr_accessor :rss
6
+ def initialize rss
7
+ self.rss = rss
8
+ end
9
+
10
+ def get_via_feedzirra url
11
+
12
+ end
13
+
14
+ def get_via_restclient_crack url
15
+ rss_xml = RestClient.get(url) ;
16
+ raw_feed = Crack::XML.parse(rss_xml.to_s) ; rss = raw_feed['rss'].to_mash
17
+ end
18
+
19
+ def self.get url
20
+ new Feedzirra::Feed.fetch_and_parse(url)
21
+ end
22
+
23
+ def entry
24
+ rss.entries.first
25
+ end
26
+
27
+ def to_activity_stream_entry
28
+ ActivityStreams::Entry.adapt(
29
+ :activity_verb => :post,
30
+ :id => entry.entry_id,
31
+ :title => entry.title,
32
+ :content => entry.summary,
33
+ :summary => entry.summary,
34
+ :published => entry.published,
35
+ :link_
36
+ ) do |entry|
37
+ entry.has_author user.name, user.url
38
+ entry.has_obj do |activity_obj|
39
+ activity_obj.id = id
40
+ activity_obj.title = text
41
+ activity_obj.published = created_at
42
+ activity_obj.updated = created_at
43
+ activity_obj.author = entry.author
44
+ end
45
+ end
46
+
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,53 @@
1
+ h2. Gowalla Blog
2
+
3
+ * http://gowalla.com/users/mrflip
4
+
5
+ title type="text"
6
+ id
7
+ entry xmlns:service="http://activitystrea.ms/service-provider" xmlns:activity="http://activitystrea.ms/spec/1.0/"
8
+ activity:verb :checkin, :share
9
+ id x
10
+ published x
11
+ updated
12
+ title x
13
+ summary x
14
+ content x
15
+ link_alt x
16
+ link_image x
17
+ link_enclosure
18
+ link_preview
19
+ link_related item.link
20
+ link_self
21
+ georss_point x
22
+ author
23
+ name [author is given at top level of feed, not in each entry]
24
+ uri .
25
+ link_photo .
26
+ activity:object
27
+ activity:object-type activity_streams:place, gowalla:spot
28
+ title x
29
+ summary
30
+ link_alt x
31
+ link_image x
32
+ link_enclosure
33
+ link_preview
34
+ link_related
35
+ georss_point
36
+ published
37
+ generator
38
+ media:description
39
+
40
+ generator
41
+ name 'delicious'
42
+ uri 'http://delicious.com'
43
+ icon 'http://cliqset-services.s3.amazonaws.com/delicious.png'
44
+
45
+ category
46
+
47
+ thr:total
48
+ thr:in_reply_to
49
+ reply
50
+
51
+ NOTES:
52
+
53
+ *
@@ -0,0 +1,46 @@
1
+ h2. Tumblr Blog
2
+
3
+ * http://www.youtube.com/darrenbounds vs http://cliqset.com/feed/atom?uid=dbounds&service=youtube
4
+
5
+ title type="text"
6
+ id
7
+ entry xmlns:service="http://activitystrea.ms/service-provider" xmlns:activity="http://activitystrea.ms/spec/1.0/"
8
+ activity:verb post for posts, photo for photos
9
+ id item.guid
10
+ published item.pubDate
11
+ updated [whatever]
12
+ link_alt
13
+ link_self
14
+ link_related
15
+ link_enclosure
16
+ link_preview
17
+ title item.title
18
+ summary item.description
19
+ author
20
+ name [parse channel.generator]
21
+ uri channel.link
22
+ link_photo
23
+ activity:object
24
+ activity:object-type
25
+ title
26
+ summary .
27
+ media:description
28
+ link_preview
29
+ link_alt
30
+ link_enclosure
31
+ activity:object [generates additional objects by parsing contents: photos, etc.]
32
+ link_preview [fetches photo and thumbnails]
33
+
34
+ generator
35
+ name 'tumblr'
36
+ uri 'http://tumblr.com'
37
+ icon http://cliqset-services.s3.amazonaws.com/tumblr.png
38
+ category item.category
39
+
40
+ thr:total
41
+ thr:in_reply_to
42
+ reply
43
+
44
+ NOTES:
45
+
46
+ * Fetches photo
@@ -0,0 +1,31 @@
1
+ id
2
+ published
3
+ title
4
+
5
+ generator
6
+ summary ...
7
+ content
8
+ author
9
+ name
10
+ uri
11
+ id
12
+ poco:link
13
+
14
+ activity:verb
15
+
16
+ category
17
+
18
+ source
19
+ id .
20
+ title .
21
+ link_alt actual endpoint queried
22
+ updated .
23
+
24
+ activity:actor
25
+
26
+ activity:object
27
+ id .
28
+
29
+
30
+
31
+ entry link rel alt is missing
@@ -0,0 +1,50 @@
1
+ # require 'feedzirra'
2
+ require 'crack'
3
+ require 'extlib/mash'
4
+ require 'extlib/hash'
5
+
6
+ module Titi::Provider
7
+ module TwitterRss
8
+ class UserTimeline
9
+ attr_accessor :rss
10
+ def initialize
11
+ # hi darren
12
+ # self.rss = Feedzirra::Feed.fetch_and_parse("http://twitter.com/statuses/user_timeline/dbounds.rss")
13
+ rss_xml = RestClient.get("http://twitter.com/statuses/user_timeline/dbounds.rss")
14
+ self.raw_feed = Crack::XML.parse(rss_xml.to_s)
15
+ self.rss = raw_feed['rss'].to_mash
16
+ end
17
+
18
+ def entry
19
+ rss[:channel][:item].first
20
+ end
21
+
22
+ def to_activity_stream_entry
23
+ ActivityStreams::Entry.adapt(
24
+ :id => entry[:guid],
25
+ :published => entry[:pubDate],
26
+ # :updated => nil, # implementor decision
27
+ # :title => text,
28
+ # :content => text,
29
+ :verb => :post
30
+ )
31
+ do |entry|
32
+ entry.has_link(:href, :title, :rel, 'text/xhtml')
33
+ # entry.has_author user.name, user.url
34
+ # entry.has_obj do |activity_obj|
35
+ # activity_obj.id = id
36
+ # activity_obj.title = text
37
+ # activity_obj.published = created_at
38
+ # activity_obj.updated = created_at
39
+ # activity_obj.author = entry.author
40
+ # end
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+
49
+ # retweet => share
50
+ # mention, reply => threading extension
@@ -0,0 +1,3 @@
1
+
2
+
3
+ * http://www.weather.gov/alerts-beta/us.php?x=0
@@ -0,0 +1,35 @@
1
+ h2. Youtube RSS
2
+
3
+ * http://www.youtube.com/darrenbounds vs http://cliqset.com/feed/atom?uid=dbounds&service=youtube
4
+
5
+ title type="text"
6
+ id
7
+ entry xmlns:service="http://activitystrea.ms/service-provider" xmlns:activity="http://activitystrea.ms/spec/1.0/"
8
+ activity:verb post
9
+ id item.guid
10
+ published item.pubDate
11
+ updated item.atom:updated
12
+ link
13
+ title
14
+ summary
15
+ activity:object
16
+ activity:object-type video
17
+ title [html-stripped version of the description]
18
+ summary
19
+ media:description item.atom:content type="text"
20
+ link_preview [parse from item.description]
21
+ link_alt item.link
22
+ link_enclosure [parse from video name]
23
+ generator
24
+ name 'youtube'
25
+ uri 'http://youtube.com'
26
+ icon 'http://cliqset-services.s3.amazonaws.com/youtube.png'
27
+ author
28
+ name [from channel.title]
29
+ uri channel.link
30
+ link_photo channel.image.url
31
+ category [none]
32
+
33
+ thr:total
34
+ thr:in_reply_to
35
+ reply
data/titi.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{titi}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mrflip"]
@@ -33,10 +33,22 @@ Gem::Specification.new do |s|
33
33
  "lib/titi/provider.rb",
34
34
  "lib/titi/provider/README.textile",
35
35
  "lib/titi/provider/activity_streams.rb",
36
+ "lib/titi/provider/activity_streams/README.textile",
36
37
  "lib/titi/provider/activity_streams/feed.xml.erb",
38
+ "lib/titi/provider/delicious/README.textile",
39
+ "lib/titi/provider/flickr/README.textile",
40
+ "lib/titi/provider/flickr/models.rb",
41
+ "lib/titi/provider/generic_rss.rb",
42
+ "lib/titi/provider/gowalla/README.textile",
43
+ "lib/titi/provider/plancast/README.textile",
37
44
  "lib/titi/provider/tripit.rb",
45
+ "lib/titi/provider/tumblr/README.textile",
38
46
  "lib/titi/provider/twitter.rb",
39
47
  "lib/titi/provider/twitter/models.rb",
48
+ "lib/titi/provider/twitter_rss/README.textile",
49
+ "lib/titi/provider/twitter_rss/models.rb",
50
+ "lib/titi/provider/weather_gov/README.textile",
51
+ "lib/titi/provider/youtube/README.textile",
40
52
  "notes/jeweler-gen.sh",
41
53
  "spec/spec.opts",
42
54
  "spec/spec_helper.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - mrflip
@@ -111,10 +111,22 @@ files:
111
111
  - lib/titi/provider.rb
112
112
  - lib/titi/provider/README.textile
113
113
  - lib/titi/provider/activity_streams.rb
114
+ - lib/titi/provider/activity_streams/README.textile
114
115
  - lib/titi/provider/activity_streams/feed.xml.erb
116
+ - lib/titi/provider/delicious/README.textile
117
+ - lib/titi/provider/flickr/README.textile
118
+ - lib/titi/provider/flickr/models.rb
119
+ - lib/titi/provider/generic_rss.rb
120
+ - lib/titi/provider/gowalla/README.textile
121
+ - lib/titi/provider/plancast/README.textile
115
122
  - lib/titi/provider/tripit.rb
123
+ - lib/titi/provider/tumblr/README.textile
116
124
  - lib/titi/provider/twitter.rb
117
125
  - lib/titi/provider/twitter/models.rb
126
+ - lib/titi/provider/twitter_rss/README.textile
127
+ - lib/titi/provider/twitter_rss/models.rb
128
+ - lib/titi/provider/weather_gov/README.textile
129
+ - lib/titi/provider/youtube/README.textile
118
130
  - notes/jeweler-gen.sh
119
131
  - spec/spec.opts
120
132
  - spec/spec_helper.rb