ActivityStreams
A RubyGem for ActivityStreams Publishers
Installation
gem install activitystreams
Resources
ActivityStreams Official Site (activitystrea.ms/) JSON Activity Streams 1.0 (activitystrea.ms/specs/json/1.0/)
Examples
Single Activity
You can see more examples in spec/serializations/*
actor = ActivityStreams::Object::Person.new(
:id => 'example.com/nov',
:display_name => 'Nov Matake'
)
place = ActivityStreams::Object::Place.new(
:display_name => 'Starbacks Coffee Shibuya',
:position => ActivityStreams::Object::Place::GeoLocation.new(
:latitude => 35.0,
:longitude => 140.0,
:altitude => 100
)
)
activity = ActivityStreams::Activity.new(
:actor => actor,
:object => place,
:verb => ActivityStreams::Verb::Checkin.new,
:published => Time.now.utc
)
activity.to_json
Stream (= collection of activities)
actor = ActivityStreams::Object::Person.new(
:id => 'example.com/nov',
:display_name => 'Nov Matake'
)
stream = ActivityStreams::Stream.new(
:items => [
ActivityStreams::Activity.new(
:actor => actor,
:object => ActivityStreams::Object::Bookmark.new(
:url => 'http://bookmark.example.com/links/12345',
:target_url => 'http://example.com/articles/12345'
),
:verb => ActivityStreams::Verb::Post.new,
:published => published
),
ActivityStreams::Activity.new(
:actor => actor,
:object => ActivityStreams::Object::Place.new(
:display_name => 'Starbacks Coffee Shibuya',
:position => ActivityStreams::Object::Place::GeoLocation.new(
:latitude => 35.0,
:longitude => 140.0,
:altitude => 100
)
),
:verb => ActivityStreams::Verb::Checkin.new,
:published => published
)
],
:url => 'http://example.com/nov/stream',
:total_count => 10
)
stream.to_json
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2011 nov matake. See LICENSE for details.