activitystreams 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,5 +1,21 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
- coverage/*
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage*
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
@@ -0,0 +1,5 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - jruby
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ activitystreams (0.0.3)
5
+ activesupport (>= 2.3)
6
+ addressable
7
+ attr_required (>= 0.0.3)
8
+ i18n
9
+ json (>= 1.4.3)
10
+
11
+ GEM
12
+ remote: http://rubygems.org/
13
+ specs:
14
+ activesupport (3.0.9)
15
+ addressable (2.2.6)
16
+ attr_required (0.0.3)
17
+ diff-lcs (1.1.2)
18
+ i18n (0.6.0)
19
+ json (1.5.3)
20
+ rake (0.9.2)
21
+ rcov (0.9.10)
22
+ rspec (2.6.0)
23
+ rspec-core (~> 2.6.0)
24
+ rspec-expectations (~> 2.6.0)
25
+ rspec-mocks (~> 2.6.0)
26
+ rspec-core (2.6.4)
27
+ rspec-expectations (2.6.0)
28
+ diff-lcs (~> 1.1.2)
29
+ rspec-mocks (2.6.0)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ activitystreams!
36
+ rake (>= 0.8)
37
+ rcov (>= 0.9)
38
+ rspec (>= 2)
@@ -13,11 +13,7 @@ JSON Activity Streams 1.0 (http://activitystrea.ms/specs/json/1.0/)
13
13
 
14
14
  == Examples
15
15
 
16
- === Stream Serialization
17
-
18
- Coming Soon..
19
-
20
- === Single Activity Serialization
16
+ === Single Activity
21
17
 
22
18
  You can see more examples in spec/serializations/*
23
19
 
@@ -41,6 +37,42 @@ You can see more examples in spec/serializations/*
41
37
  )
42
38
  activity.to_json
43
39
 
40
+ === Stream (= collection of activities)
41
+
42
+ actor = ActivityStreams::Object::Person.new(
43
+ :id => 'example.com/nov',
44
+ :display_name => 'Nov Matake'
45
+ )
46
+ stream = ActivityStreams::Stream.new(
47
+ :items => [
48
+ ActivityStreams::Activity.new(
49
+ :actor => actor,
50
+ :object => ActivityStreams::Object::Bookmark.new(
51
+ :url => 'http://bookmark.example.com/links/12345',
52
+ :target_url => 'http://example.com/articles/12345'
53
+ ),
54
+ :verb => ActivityStreams::Verb::Post.new,
55
+ :published => published
56
+ ),
57
+ ActivityStreams::Activity.new(
58
+ :actor => actor,
59
+ :object => ActivityStreams::Object::Place.new(
60
+ :display_name => 'Starbacks Coffee Shibuya',
61
+ :position => ActivityStreams::Object::Place::GeoLocation.new(
62
+ :latitude => 35.0,
63
+ :longitude => 140.0,
64
+ :altitude => 100
65
+ )
66
+ ),
67
+ :verb => ActivityStreams::Verb::Checkin.new,
68
+ :published => published
69
+ )
70
+ ],
71
+ :url => 'http://example.com/nov/stream',
72
+ :total_count => 10
73
+ )
74
+ stream.to_json
75
+
44
76
  == Note on Patches/Pull Requests
45
77
 
46
78
  * Fork the project.
data/Rakefile CHANGED
@@ -1,11 +1,19 @@
1
- require 'bundler/gem_tasks'
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
2
3
 
3
4
  require 'rspec/core/rake_task'
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- RSpec::Core::RakeTask.new(:rcov) do |spec|
7
- spec.rcov = true
8
- spec.rcov_opts = ['-Ilib -Ispec --exclude spec,gems']
7
+ if RUBY_VERSION >= '1.9'
8
+ require 'cover_me'
9
+ CoverMe.config do |c|
10
+ c.file_pattern = /(#{CoverMe.config.project.root}\/lib\/.+\.rb)/i
11
+ end
12
+ else
13
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
14
+ spec.rcov = true
15
+ spec.rcov_opts = ['-Ilib -Ispec --exclude spec,gems']
16
+ end
9
17
  end
10
18
 
11
19
  task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -13,9 +13,13 @@ Gem::Specification.new do |s|
13
13
  s.add_runtime_dependency "json", ">= 1.4.3"
14
14
  s.add_runtime_dependency "activesupport", ">= 2.3"
15
15
  s.add_runtime_dependency "i18n"
16
- s.add_runtime_dependency "attr_required", ">= 0.0.3"
16
+ s.add_runtime_dependency "attr_required", ">= 0.0.5"
17
17
  s.add_runtime_dependency "addressable"
18
18
  s.add_development_dependency "rake", ">= 0.8"
19
- s.add_development_dependency "rcov", ">= 0.9"
19
+ if RUBY_VERSION >= '1.9'
20
+ s.add_development_dependency "cover_me", ">= 1.2.0"
21
+ else
22
+ s.add_development_dependency "rcov", ">= 0.9"
23
+ end
20
24
  s.add_development_dependency "rspec", ">= 2"
21
25
  end
@@ -11,7 +11,8 @@ describe 'Post a Bookmark' do
11
11
  end
12
12
  let :object do
13
13
  ActivityStreams::Object::Bookmark.new(
14
- :target_url => 'http://bookmark.example.com/links/12345'
14
+ :url => 'http://bookmark.example.com/links/12345',
15
+ :target_url => 'http://example.com/articles/12345'
15
16
  )
16
17
  end
17
18
  let :activity do
@@ -34,7 +35,8 @@ describe 'Post a Bookmark' do
34
35
  'published' => published.iso8601,
35
36
  'object' => {
36
37
  'objectType' => 'bookmark',
37
- 'targetUrl' => 'http://bookmark.example.com/links/12345'
38
+ 'url' => 'http://bookmark.example.com/links/12345',
39
+ 'targetUrl' => 'http://example.com/articles/12345'
38
40
  }
39
41
  }
40
42
  end
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Stream Serialization' do
4
+ let(:published) { Time.now.utc }
5
+ let :actor do
6
+ ActivityStreams::Object::Person.new(
7
+ :id => 'example.com/nov',
8
+ :display_name => 'Nov Matake'
9
+ )
10
+ end
11
+ let :stream do
12
+ ActivityStreams::Stream.new(
13
+ :items => [
14
+ ActivityStreams::Activity.new(
15
+ :actor => actor,
16
+ :object => ActivityStreams::Object::Bookmark.new(
17
+ :url => 'http://bookmark.example.com/links/12345',
18
+ :target_url => 'http://example.com/articles/12345'
19
+ ),
20
+ :verb => ActivityStreams::Verb::Post.new,
21
+ :published => published
22
+ ),
23
+ ActivityStreams::Activity.new(
24
+ :actor => actor,
25
+ :object => ActivityStreams::Object::Place.new(
26
+ :display_name => 'Starbacks Coffee Shibuya',
27
+ :position => ActivityStreams::Object::Place::GeoLocation.new(
28
+ :latitude => 35.0,
29
+ :longitude => 140.0,
30
+ :altitude => 100
31
+ )
32
+ ),
33
+ :verb => ActivityStreams::Verb::Checkin.new,
34
+ :published => published
35
+ )
36
+ ],
37
+ :url => 'http://example.com/nov/stream',
38
+ :total_count => 10
39
+ )
40
+ end
41
+
42
+ it 'should be well formatted' do
43
+ JSON.parse(stream.to_json).should == {
44
+ 'items' => [{
45
+ 'actor' => {
46
+ 'id' => 'example.com/nov',
47
+ 'displayName' => 'Nov Matake',
48
+ 'objectType' => 'person'
49
+ },
50
+ 'verb' => 'post',
51
+ 'published' => published.iso8601,
52
+ 'object' => {
53
+ 'objectType' => 'bookmark',
54
+ 'url' => 'http://bookmark.example.com/links/12345',
55
+ 'targetUrl' => 'http://example.com/articles/12345'
56
+ }
57
+ }, {
58
+ 'actor' => {
59
+ 'id' => 'example.com/nov',
60
+ 'displayName' => 'Nov Matake',
61
+ 'objectType' => 'person'
62
+ },
63
+ 'verb' => 'checkin',
64
+ 'published' => published.iso8601,
65
+ 'object' => {
66
+ 'displayName' => 'Starbacks Coffee Shibuya',
67
+ 'objectType' => 'place',
68
+ 'position' => '+35.0+140.0+100'
69
+ }
70
+ }],
71
+ 'totalCount' => 10,
72
+ 'url' => 'http://example.com/nov/stream'
73
+ }
74
+ end
75
+ end
@@ -1,5 +1,9 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
1
+ if RUBY_VERSION >= '1.9'
2
+ require 'cover_me'
3
+ at_exit do
4
+ CoverMe.complete!
5
+ end
6
+ end
3
7
 
4
8
  require 'activitystreams'
5
9
  require 'rspec'
metadata CHANGED
@@ -1,153 +1,115 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: activitystreams
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - nov matake
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-07-12 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-16 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: json
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70120870592240 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 1
29
- segments:
30
- - 1
31
- - 4
32
- - 3
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 1.4.3
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: activesupport
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70120870592240
25
+ - !ruby/object:Gem::Dependency
26
+ name: activesupport
27
+ requirement: &70120870591040 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 5
45
- segments:
46
- - 2
47
- - 3
48
- version: "2.3"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '2.3'
49
33
  type: :runtime
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: i18n
53
34
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70120870591040
36
+ - !ruby/object:Gem::Dependency
37
+ name: i18n
38
+ requirement: &70120870590040 !ruby/object:Gem::Requirement
55
39
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
63
44
  type: :runtime
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: attr_required
67
45
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70120870590040
47
+ - !ruby/object:Gem::Dependency
48
+ name: attr_required
49
+ requirement: &70120870582240 !ruby/object:Gem::Requirement
69
50
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 25
74
- segments:
75
- - 0
76
- - 0
77
- - 3
78
- version: 0.0.3
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.5
79
55
  type: :runtime
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: addressable
83
56
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70120870582240
58
+ - !ruby/object:Gem::Dependency
59
+ name: addressable
60
+ requirement: &70120870580060 !ruby/object:Gem::Requirement
85
61
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
93
66
  type: :runtime
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: rake
97
67
  prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70120870580060
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: &70120870576620 !ruby/object:Gem::Requirement
99
72
  none: false
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- hash: 27
104
- segments:
105
- - 0
106
- - 8
107
- version: "0.8"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0.8'
108
77
  type: :development
109
- version_requirements: *id006
110
- - !ruby/object:Gem::Dependency
111
- name: rcov
112
78
  prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *70120870576620
80
+ - !ruby/object:Gem::Dependency
81
+ name: cover_me
82
+ requirement: &70120870567360 !ruby/object:Gem::Requirement
114
83
  none: false
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- hash: 25
119
- segments:
120
- - 0
121
- - 9
122
- version: "0.9"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: 1.2.0
123
88
  type: :development
124
- version_requirements: *id007
125
- - !ruby/object:Gem::Dependency
126
- name: rspec
127
89
  prerelease: false
128
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *70120870567360
91
+ - !ruby/object:Gem::Dependency
92
+ name: rspec
93
+ requirement: &70120870566780 !ruby/object:Gem::Requirement
129
94
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 7
134
- segments:
135
- - 2
136
- version: "2"
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '2'
137
99
  type: :development
138
- version_requirements: *id008
100
+ prerelease: false
101
+ version_requirements: *70120870566780
139
102
  description: A RubyGem for ActivityStreams Publishers
140
- email:
103
+ email:
141
104
  - nov@matake.jp
142
105
  executables: []
143
-
144
106
  extensions: []
145
-
146
107
  extra_rdoc_files: []
147
-
148
- files:
108
+ files:
149
109
  - .gitignore
110
+ - .travis.yml
150
111
  - Gemfile
112
+ - Gemfile.lock
151
113
  - LICENSE
152
114
  - README.rdoc
153
115
  - Rakefile
@@ -240,41 +202,33 @@ files:
240
202
  - spec/serializations/checkin_a_place_spec.rb
241
203
  - spec/serializations/post_a_bookmark_spec.rb
242
204
  - spec/serializations/post_an_article_on_a_blog_spec.rb
205
+ - spec/serializations/stream_spec.rb
243
206
  - spec/spec_helper.rb
244
207
  homepage: http://github.com/nov/activitystreams
245
208
  licenses: []
246
-
247
209
  post_install_message:
248
210
  rdoc_options: []
249
-
250
- require_paths:
211
+ require_paths:
251
212
  - lib
252
- required_ruby_version: !ruby/object:Gem::Requirement
213
+ required_ruby_version: !ruby/object:Gem::Requirement
253
214
  none: false
254
- requirements:
255
- - - ">="
256
- - !ruby/object:Gem::Version
257
- hash: 3
258
- segments:
259
- - 0
260
- version: "0"
261
- required_rubygems_version: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - ! '>='
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
219
+ required_rubygems_version: !ruby/object:Gem::Requirement
262
220
  none: false
263
- requirements:
264
- - - ">="
265
- - !ruby/object:Gem::Version
266
- hash: 3
267
- segments:
268
- - 0
269
- version: "0"
221
+ requirements:
222
+ - - ! '>='
223
+ - !ruby/object:Gem::Version
224
+ version: '0'
270
225
  requirements: []
271
-
272
226
  rubyforge_project:
273
- rubygems_version: 1.8.5
227
+ rubygems_version: 1.8.12
274
228
  signing_key:
275
229
  specification_version: 3
276
230
  summary: A RubyGem for ActivityStreams Publishers
277
- test_files:
231
+ test_files:
278
232
  - spec/activitystreams/activity_spec.rb
279
233
  - spec/activitystreams/base_spec.rb
280
234
  - spec/activitystreams/collection_spec.rb
@@ -303,4 +257,5 @@ test_files:
303
257
  - spec/serializations/checkin_a_place_spec.rb
304
258
  - spec/serializations/post_a_bookmark_spec.rb
305
259
  - spec/serializations/post_an_article_on_a_blog_spec.rb
260
+ - spec/serializations/stream_spec.rb
306
261
  - spec/spec_helper.rb