activitystreams 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
= ActivityStreams
|
2
|
+
|
3
|
+
A RubyGem for ActivityStreams Publishers
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
gem install activitystreams
|
8
|
+
|
9
|
+
== Resources
|
10
|
+
|
11
|
+
ActivityStreams Official Site (http://activitystrea.ms/)
|
12
|
+
JSON Activity Streams 1.0 (http://activitystrea.ms/specs/json/1.0/)
|
13
|
+
|
14
|
+
== Examples
|
15
|
+
|
16
|
+
=== Stream Serialization
|
17
|
+
|
18
|
+
Coming Soon..
|
19
|
+
|
20
|
+
=== Single Activity Serialization
|
21
|
+
|
22
|
+
You can see more examples in spec/serializations/*
|
23
|
+
|
24
|
+
actor = ActivityStreams::Object::Person.new(
|
25
|
+
:id => 'example.com/nov',
|
26
|
+
:display_name => 'Nov Matake'
|
27
|
+
)
|
28
|
+
place = ActivityStreams::Object::Place.new(
|
29
|
+
:display_name => 'Starbacks Coffee Shibuya',
|
30
|
+
:position => ActivityStreams::Object::Place::GeoLocation.new(
|
31
|
+
:latitude => 35.0,
|
32
|
+
:longitude => 140.0,
|
33
|
+
:altitude => 100
|
34
|
+
)
|
35
|
+
)
|
36
|
+
activity = ActivityStreams::Activity.new(
|
37
|
+
:actor => actor,
|
38
|
+
:object => place,
|
39
|
+
:verb => ActivityStreams::Verb::Checkin.new,
|
40
|
+
:published => Time.now.utc
|
41
|
+
)
|
42
|
+
activity.to_json
|
43
|
+
|
44
|
+
== Note on Patches/Pull Requests
|
45
|
+
|
46
|
+
* Fork the project.
|
47
|
+
* Make your feature addition or bug fix.
|
48
|
+
* Add tests for it. This is important so I don't break it in a
|
49
|
+
future version unintentionally.
|
50
|
+
* Commit, do not mess with rakefile, version, or history.
|
51
|
+
(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)
|
52
|
+
* Send me a pull request. Bonus points for topic branches.
|
53
|
+
|
54
|
+
== Copyright
|
55
|
+
|
56
|
+
Copyright (c) 2011 nov matake. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Checkin a Place' do
|
4
|
+
let(:verb) { ActivityStreams::Verb::Checkin.new }
|
5
|
+
let(:published) { Time.now.utc }
|
6
|
+
let :actor do
|
7
|
+
ActivityStreams::Object::Person.new(
|
8
|
+
:id => 'example.com/nov',
|
9
|
+
:display_name => 'Nov Matake'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
let :object do
|
13
|
+
ActivityStreams::Object::Place.new(
|
14
|
+
:display_name => 'Starbacks Coffee Shibuya',
|
15
|
+
:position => ActivityStreams::Object::Place::GeoLocation.new(
|
16
|
+
:latitude => 35.0,
|
17
|
+
:longitude => 140.0,
|
18
|
+
:altitude => 100
|
19
|
+
)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
let :activity do
|
23
|
+
ActivityStreams::Activity.new(
|
24
|
+
:actor => actor,
|
25
|
+
:object => object,
|
26
|
+
:verb => verb,
|
27
|
+
:published => published
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should be well formatted' do
|
32
|
+
JSON.parse(activity.to_json).should == {
|
33
|
+
'actor' => {
|
34
|
+
'id' => 'example.com/nov',
|
35
|
+
'displayName' => 'Nov Matake',
|
36
|
+
'objectType' => 'person'
|
37
|
+
},
|
38
|
+
'verb' => 'checkin',
|
39
|
+
'published' => published.iso8601,
|
40
|
+
'object' => {
|
41
|
+
'objectType' => 'place',
|
42
|
+
'displayName' => 'Starbacks Coffee Shibuya',
|
43
|
+
'position' => '+35.0+140.0+100'
|
44
|
+
}
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Post a Bookmark' do
|
4
|
+
let(:verb) { ActivityStreams::Verb::Post.new }
|
5
|
+
let(:published) { Time.now.utc }
|
6
|
+
let :actor do
|
7
|
+
ActivityStreams::Object::Person.new(
|
8
|
+
:id => 'example.com/nov',
|
9
|
+
:display_name => 'Nov Matake'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
let :object do
|
13
|
+
ActivityStreams::Object::Bookmark.new(
|
14
|
+
:target_url => 'http://bookmark.example.com/links/12345'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
let :activity do
|
18
|
+
ActivityStreams::Activity.new(
|
19
|
+
:actor => actor,
|
20
|
+
:object => object,
|
21
|
+
:verb => verb,
|
22
|
+
:published => published
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should be well formatted' do
|
27
|
+
JSON.parse(activity.to_json).should == {
|
28
|
+
'actor' => {
|
29
|
+
'id' => 'example.com/nov',
|
30
|
+
'displayName' => 'Nov Matake',
|
31
|
+
'objectType' => 'person'
|
32
|
+
},
|
33
|
+
'verb' => 'post',
|
34
|
+
'published' => published.iso8601,
|
35
|
+
'object' => {
|
36
|
+
'objectType' => 'bookmark',
|
37
|
+
'targetUrl' => 'http://bookmark.example.com/links/12345'
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# NOTE:
|
4
|
+
# I'm not sure this is proper object type usage,
|
5
|
+
# but the official document uses 'blog' as a object type in 'Example Activities' Section (3.1).
|
6
|
+
# ref) http://activitystrea.ms/specs/json/1.0/
|
7
|
+
|
8
|
+
describe 'Post an Article on a Blog' do
|
9
|
+
let(:verb) { ActivityStreams::Verb::Post.new }
|
10
|
+
let(:published) { Time.now.utc }
|
11
|
+
let :actor do
|
12
|
+
ActivityStreams::Object::Person.new(
|
13
|
+
:id => 'tag:example.org,2011:martin',
|
14
|
+
:display_name => 'Nov Matake',
|
15
|
+
:url => 'http://example.org/martin',
|
16
|
+
:image => ActivityStreams::MediaLink.new(
|
17
|
+
:url => 'http://example.org/martin/image',
|
18
|
+
:width => 250,
|
19
|
+
:height => 250
|
20
|
+
)
|
21
|
+
)
|
22
|
+
end
|
23
|
+
let :object do
|
24
|
+
ActivityStreams::Object.new(
|
25
|
+
:id => 'tag:example.org,2011:abc123/xyz',
|
26
|
+
:url => 'http://example.org/blog/2011/02/entry'
|
27
|
+
)
|
28
|
+
end
|
29
|
+
let :target do
|
30
|
+
ActivityStreams::Object.new(
|
31
|
+
:object_type => 'blog',
|
32
|
+
:id => 'tag:example.org,2011:abc123',
|
33
|
+
:display_name => 'Martin\'s Blog',
|
34
|
+
:url => 'http://blog.example.com'
|
35
|
+
)
|
36
|
+
end
|
37
|
+
let :activity do
|
38
|
+
ActivityStreams::Activity.new(
|
39
|
+
:actor => actor,
|
40
|
+
:object => object,
|
41
|
+
:target => target,
|
42
|
+
:verb => verb,
|
43
|
+
:published => published
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should be well formatted' do
|
48
|
+
JSON.parse(activity.to_json).should == {
|
49
|
+
'published' => published.iso8601,
|
50
|
+
'actor' => {
|
51
|
+
'url' => 'http://example.org/martin',
|
52
|
+
'objectType' => 'person',
|
53
|
+
'id' => 'tag:example.org,2011:martin',
|
54
|
+
'image' => {
|
55
|
+
'url' => 'http://example.org/martin/image',
|
56
|
+
'width' => 250,
|
57
|
+
'height' => 250
|
58
|
+
},
|
59
|
+
'displayName' => 'Nov Matake'
|
60
|
+
},
|
61
|
+
'verb' => 'post',
|
62
|
+
'object' => {
|
63
|
+
'url' => 'http://example.org/blog/2011/02/entry',
|
64
|
+
'id' => 'tag:example.org,2011:abc123/xyz'
|
65
|
+
},
|
66
|
+
'target' => {
|
67
|
+
'url' => 'http://blog.example.com',
|
68
|
+
'objectType' => 'blog',
|
69
|
+
'id' => 'tag:example.org,2011:abc123',
|
70
|
+
'displayName' => 'Martin\'s Blog'
|
71
|
+
}
|
72
|
+
}
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activitystreams
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- nov matake
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- .gitignore
|
150
150
|
- Gemfile
|
151
151
|
- LICENSE
|
152
|
+
- README.rdoc
|
152
153
|
- Rakefile
|
153
154
|
- VERSION
|
154
155
|
- activitystreams.gemspec
|
@@ -195,6 +196,7 @@ files:
|
|
195
196
|
- lib/activitystreams/verb/like.rb
|
196
197
|
- lib/activitystreams/verb/make_friend.rb
|
197
198
|
- lib/activitystreams/verb/play.rb
|
199
|
+
- lib/activitystreams/verb/post.rb
|
198
200
|
- lib/activitystreams/verb/receive.rb
|
199
201
|
- lib/activitystreams/verb/remove.rb
|
200
202
|
- lib/activitystreams/verb/remove_friend.rb
|
@@ -235,6 +237,9 @@ files:
|
|
235
237
|
- spec/activitystreams/verb/rsvp_maybe_spec.rb
|
236
238
|
- spec/activitystreams/verb_spec.rb
|
237
239
|
- spec/activitystreams_spec.rb
|
240
|
+
- spec/serializations/checkin_a_place_spec.rb
|
241
|
+
- spec/serializations/post_a_bookmark_spec.rb
|
242
|
+
- spec/serializations/post_an_article_on_a_blog_spec.rb
|
238
243
|
- spec/spec_helper.rb
|
239
244
|
homepage: http://github.com/nov/activitystreams
|
240
245
|
licenses: []
|
@@ -295,4 +300,7 @@ test_files:
|
|
295
300
|
- spec/activitystreams/verb/rsvp_maybe_spec.rb
|
296
301
|
- spec/activitystreams/verb_spec.rb
|
297
302
|
- spec/activitystreams_spec.rb
|
303
|
+
- spec/serializations/checkin_a_place_spec.rb
|
304
|
+
- spec/serializations/post_a_bookmark_spec.rb
|
305
|
+
- spec/serializations/post_an_article_on_a_blog_spec.rb
|
298
306
|
- spec/spec_helper.rb
|