nelumba 0.0.13

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.
Files changed (95) hide show
  1. data/.gitignore +6 -0
  2. data/.travis.yml +9 -0
  3. data/Gemfile +20 -0
  4. data/README.md +242 -0
  5. data/Rakefile +7 -0
  6. data/assets/lotus_logo_purple.png +0 -0
  7. data/assets/lotus_logo_purple.svg +262 -0
  8. data/lib/nelumba.rb +47 -0
  9. data/lib/nelumba/activity.rb +250 -0
  10. data/lib/nelumba/application.rb +11 -0
  11. data/lib/nelumba/article.rb +11 -0
  12. data/lib/nelumba/atom/account.rb +50 -0
  13. data/lib/nelumba/atom/address.rb +56 -0
  14. data/lib/nelumba/atom/author.rb +176 -0
  15. data/lib/nelumba/atom/category.rb +41 -0
  16. data/lib/nelumba/atom/comment.rb +96 -0
  17. data/lib/nelumba/atom/entry.rb +216 -0
  18. data/lib/nelumba/atom/feed.rb +198 -0
  19. data/lib/nelumba/atom/generator.rb +40 -0
  20. data/lib/nelumba/atom/link.rb +79 -0
  21. data/lib/nelumba/atom/name.rb +57 -0
  22. data/lib/nelumba/atom/organization.rb +62 -0
  23. data/lib/nelumba/atom/person.rb +179 -0
  24. data/lib/nelumba/atom/portable_contacts.rb +117 -0
  25. data/lib/nelumba/atom/source.rb +179 -0
  26. data/lib/nelumba/atom/thread.rb +60 -0
  27. data/lib/nelumba/audio.rb +39 -0
  28. data/lib/nelumba/badge.rb +11 -0
  29. data/lib/nelumba/binary.rb +52 -0
  30. data/lib/nelumba/bookmark.rb +30 -0
  31. data/lib/nelumba/category.rb +49 -0
  32. data/lib/nelumba/collection.rb +34 -0
  33. data/lib/nelumba/comment.rb +47 -0
  34. data/lib/nelumba/crypto.rb +144 -0
  35. data/lib/nelumba/device.rb +11 -0
  36. data/lib/nelumba/discover.rb +362 -0
  37. data/lib/nelumba/event.rb +57 -0
  38. data/lib/nelumba/feed.rb +173 -0
  39. data/lib/nelumba/file.rb +43 -0
  40. data/lib/nelumba/generator.rb +53 -0
  41. data/lib/nelumba/group.rb +11 -0
  42. data/lib/nelumba/identity.rb +63 -0
  43. data/lib/nelumba/image.rb +30 -0
  44. data/lib/nelumba/link.rb +56 -0
  45. data/lib/nelumba/note.rb +34 -0
  46. data/lib/nelumba/notification.rb +229 -0
  47. data/lib/nelumba/object.rb +251 -0
  48. data/lib/nelumba/person.rb +306 -0
  49. data/lib/nelumba/place.rb +34 -0
  50. data/lib/nelumba/product.rb +30 -0
  51. data/lib/nelumba/publisher.rb +44 -0
  52. data/lib/nelumba/question.rb +30 -0
  53. data/lib/nelumba/review.rb +30 -0
  54. data/lib/nelumba/service.rb +11 -0
  55. data/lib/nelumba/subscription.rb +117 -0
  56. data/lib/nelumba/version.rb +3 -0
  57. data/lib/nelumba/video.rb +43 -0
  58. data/nelumba.gemspec +28 -0
  59. data/spec/activity_spec.rb +116 -0
  60. data/spec/application_spec.rb +136 -0
  61. data/spec/article_spec.rb +136 -0
  62. data/spec/atom/comment_spec.rb +455 -0
  63. data/spec/atom/feed_spec.rb +684 -0
  64. data/spec/audio_spec.rb +164 -0
  65. data/spec/badge_spec.rb +136 -0
  66. data/spec/binary_spec.rb +218 -0
  67. data/spec/bookmark.rb +150 -0
  68. data/spec/collection_spec.rb +152 -0
  69. data/spec/comment_spec.rb +128 -0
  70. data/spec/crypto_spec.rb +126 -0
  71. data/spec/device_spec.rb +136 -0
  72. data/spec/event_spec.rb +239 -0
  73. data/spec/feed_spec.rb +252 -0
  74. data/spec/file_spec.rb +190 -0
  75. data/spec/group_spec.rb +136 -0
  76. data/spec/helper.rb +10 -0
  77. data/spec/identity_spec.rb +67 -0
  78. data/spec/image_spec.rb +150 -0
  79. data/spec/link_spec.rb +30 -0
  80. data/spec/note_spec.rb +163 -0
  81. data/spec/notification_spec.rb +89 -0
  82. data/spec/person_spec.rb +244 -0
  83. data/spec/place_spec.rb +162 -0
  84. data/spec/product_spec.rb +150 -0
  85. data/spec/question_spec.rb +156 -0
  86. data/spec/review_spec.rb +149 -0
  87. data/spec/service_spec.rb +136 -0
  88. data/spec/video_spec.rb +164 -0
  89. data/test/example_feed.atom +393 -0
  90. data/test/example_feed_empty_author.atom +336 -0
  91. data/test/example_feed_false_connected.atom +359 -0
  92. data/test/example_feed_link_without_href.atom +134 -0
  93. data/test/example_page.html +4 -0
  94. data/test/mime_type_bug_feed.atom +874 -0
  95. metadata +288 -0
@@ -0,0 +1,164 @@
1
+ require_relative 'helper'
2
+ require_relative '../lib/nelumba/audio.rb'
3
+
4
+ describe Nelumba::Audio do
5
+ describe "#initialize" do
6
+ it "should store an author" do
7
+ author = mock('author')
8
+ Nelumba::Audio.new(:author => author).author.must_equal author
9
+ end
10
+
11
+ it "should store the stream" do
12
+ Nelumba::Audio.new(:stream => "txt").stream.must_equal "txt"
13
+ end
14
+
15
+ it "should store the embed code" do
16
+ Nelumba::Audio.new(:embed_code => "txt").embed_code.must_equal "txt"
17
+ end
18
+
19
+ it "should store content" do
20
+ Nelumba::Audio.new(:content => "txt").content.must_equal "txt"
21
+ end
22
+
23
+ it "should store the published date" do
24
+ time = mock('date')
25
+ Nelumba::Audio.new(:published => time).published.must_equal time
26
+ end
27
+
28
+ it "should store the updated date" do
29
+ time = mock('date')
30
+ Nelumba::Audio.new(:updated => time).updated.must_equal time
31
+ end
32
+
33
+ it "should store a display name" do
34
+ Nelumba::Audio.new(:display_name => "url")
35
+ .display_name.must_equal "url"
36
+ end
37
+
38
+ it "should store a summary" do
39
+ Nelumba::Audio.new(:summary => "url").summary.must_equal "url"
40
+ end
41
+
42
+ it "should store a url" do
43
+ Nelumba::Audio.new(:url => "url").url.must_equal "url"
44
+ end
45
+
46
+ it "should store an id" do
47
+ Nelumba::Audio.new(:uid => "id").uid.must_equal "id"
48
+ end
49
+ end
50
+
51
+ describe "#to_hash" do
52
+ it "should contain the stream" do
53
+ Nelumba::Audio.new(:stream => "txt")
54
+ .to_hash[:stream].must_equal "txt"
55
+ end
56
+
57
+ it "should contain the embed code" do
58
+ Nelumba::Audio.new(:embed_code => "txt")
59
+ .to_hash[:embed_code].must_equal "txt"
60
+ end
61
+
62
+ it "should contain the content" do
63
+ Nelumba::Audio.new(:content => "Hello")
64
+ .to_hash[:content].must_equal "Hello"
65
+ end
66
+
67
+ it "should contain the author" do
68
+ author = mock('Nelumba::Person')
69
+ Nelumba::Audio.new(:author => author).to_hash[:author].must_equal author
70
+ end
71
+
72
+ it "should contain the uid" do
73
+ Nelumba::Audio.new(:uid => "Hello").to_hash[:uid].must_equal "Hello"
74
+ end
75
+
76
+ it "should contain the url" do
77
+ Nelumba::Audio.new(:url => "Hello").to_hash[:url].must_equal "Hello"
78
+ end
79
+
80
+ it "should contain the summary" do
81
+ Nelumba::Audio.new(:summary=> "Hello")
82
+ .to_hash[:summary].must_equal "Hello"
83
+ end
84
+
85
+ it "should contain the display name" do
86
+ Nelumba::Audio.new(:display_name => "Hello")
87
+ .to_hash[:display_name].must_equal "Hello"
88
+ end
89
+
90
+ it "should contain the published date" do
91
+ date = mock('Time')
92
+ Nelumba::Audio.new(:published => date).to_hash[:published].must_equal date
93
+ end
94
+
95
+ it "should contain the updated date" do
96
+ date = mock('Time')
97
+ Nelumba::Audio.new(:updated => date).to_hash[:updated].must_equal date
98
+ end
99
+ end
100
+
101
+ describe "#to_json" do
102
+ before do
103
+ author = Nelumba::Person.new :display_name => "wilkie"
104
+ @note = Nelumba::Audio.new :content => "Hello",
105
+ :author => author,
106
+ :embed_code => "code",
107
+ :stream => "foo",
108
+ :summary => "foo",
109
+ :display_name => "meh",
110
+ :uid => "id",
111
+ :url => "url",
112
+ :title => "title",
113
+ :published => Time.now,
114
+ :updated => Time.now
115
+
116
+ @json = @note.to_json
117
+ @data = JSON.parse(@json)
118
+ end
119
+
120
+ it "should contain the embedded json for the author" do
121
+ @data["author"].must_equal JSON.parse(@note.author.to_json)
122
+ end
123
+
124
+ it "should contain the stream" do
125
+ @data["stream"].must_equal @note.stream
126
+ end
127
+
128
+ it "should contain the embed code" do
129
+ @data["embedCode"].must_equal @note.embed_code
130
+ end
131
+
132
+ it "should contain a 'audio' objectType" do
133
+ @data["objectType"].must_equal "audio"
134
+ end
135
+
136
+ it "should contain the id" do
137
+ @data["id"].must_equal @note.uid
138
+ end
139
+
140
+ it "should contain the content" do
141
+ @data["content"].must_equal @note.content
142
+ end
143
+
144
+ it "should contain the url" do
145
+ @data["url"].must_equal @note.url
146
+ end
147
+
148
+ it "should contain the summary" do
149
+ @data["summary"].must_equal @note.summary
150
+ end
151
+
152
+ it "should contain the display name" do
153
+ @data["displayName"].must_equal @note.display_name
154
+ end
155
+
156
+ it "should contain the published date as rfc3339" do
157
+ @data["published"].must_equal @note.published.to_date.rfc3339 + 'Z'
158
+ end
159
+
160
+ it "should contain the updated date as rfc3339" do
161
+ @data["updated"].must_equal @note.updated.to_date.rfc3339 + 'Z'
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,136 @@
1
+ require_relative 'helper'
2
+ require_relative '../lib/nelumba/badge.rb'
3
+
4
+ describe Nelumba::Badge do
5
+ describe "#initialize" do
6
+ it "should store an author" do
7
+ author = mock('author')
8
+ Nelumba::Badge.new(:author => author).author.must_equal author
9
+ end
10
+
11
+ it "should store content" do
12
+ Nelumba::Badge.new(:content => "txt").content.must_equal "txt"
13
+ end
14
+
15
+ it "should store the published date" do
16
+ time = mock('date')
17
+ Nelumba::Badge.new(:published => time).published.must_equal time
18
+ end
19
+
20
+ it "should store the updated date" do
21
+ time = mock('date')
22
+ Nelumba::Badge.new(:updated => time).updated.must_equal time
23
+ end
24
+
25
+ it "should store a display name" do
26
+ Nelumba::Badge.new(:display_name => "url")
27
+ .display_name.must_equal "url"
28
+ end
29
+
30
+ it "should store a summary" do
31
+ Nelumba::Badge.new(:summary => "url").summary.must_equal "url"
32
+ end
33
+
34
+ it "should store a url" do
35
+ Nelumba::Badge.new(:url => "url").url.must_equal "url"
36
+ end
37
+
38
+ it "should store an id" do
39
+ Nelumba::Badge.new(:uid => "id").uid.must_equal "id"
40
+ end
41
+ end
42
+
43
+ describe "#to_hash" do
44
+ it "should contain the content" do
45
+ Nelumba::Badge.new(:content => "Hello")
46
+ .to_hash[:content].must_equal "Hello"
47
+ end
48
+
49
+ it "should contain the author" do
50
+ author = mock('Nelumba::Person')
51
+ Nelumba::Badge.new(:author => author).to_hash[:author].must_equal author
52
+ end
53
+
54
+ it "should contain the uid" do
55
+ Nelumba::Badge.new(:uid => "Hello").to_hash[:uid].must_equal "Hello"
56
+ end
57
+
58
+ it "should contain the url" do
59
+ Nelumba::Badge.new(:url => "Hello").to_hash[:url].must_equal "Hello"
60
+ end
61
+
62
+ it "should contain the summary" do
63
+ Nelumba::Badge.new(:summary=> "Hello")
64
+ .to_hash[:summary].must_equal "Hello"
65
+ end
66
+
67
+ it "should contain the display name" do
68
+ Nelumba::Badge.new(:display_name => "Hello")
69
+ .to_hash[:display_name].must_equal "Hello"
70
+ end
71
+
72
+ it "should contain the published date" do
73
+ date = mock('Time')
74
+ Nelumba::Badge.new(:published => date).to_hash[:published].must_equal date
75
+ end
76
+
77
+ it "should contain the updated date" do
78
+ date = mock('Time')
79
+ Nelumba::Badge.new(:updated => date).to_hash[:updated].must_equal date
80
+ end
81
+ end
82
+
83
+ describe "#to_json" do
84
+ before do
85
+ author = Nelumba::Person.new :display_name => "wilkie"
86
+ @note = Nelumba::Badge.new :content => "Hello",
87
+ :author => author,
88
+ :uid => "id",
89
+ :url => "url",
90
+ :title => "title",
91
+ :summary => "foo",
92
+ :display_name => "meh",
93
+ :published => Time.now,
94
+ :updated => Time.now
95
+
96
+ @json = @note.to_json
97
+ @data = JSON.parse(@json)
98
+ end
99
+
100
+ it "should contain the embedded json for the author" do
101
+ @data["author"].must_equal JSON.parse(@note.author.to_json)
102
+ end
103
+
104
+ it "should contain a 'badge' objectType" do
105
+ @data["objectType"].must_equal "badge"
106
+ end
107
+
108
+ it "should contain the id" do
109
+ @data["id"].must_equal @note.uid
110
+ end
111
+
112
+ it "should contain the content" do
113
+ @data["content"].must_equal @note.content
114
+ end
115
+
116
+ it "should contain the url" do
117
+ @data["url"].must_equal @note.url
118
+ end
119
+
120
+ it "should contain the summary" do
121
+ @data["summary"].must_equal @note.summary
122
+ end
123
+
124
+ it "should contain the display name" do
125
+ @data["displayName"].must_equal @note.display_name
126
+ end
127
+
128
+ it "should contain the published date as rfc3339" do
129
+ @data["published"].must_equal @note.published.to_date.rfc3339 + 'Z'
130
+ end
131
+
132
+ it "should contain the updated date as rfc3339" do
133
+ @data["updated"].must_equal @note.updated.to_date.rfc3339 + 'Z'
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,218 @@
1
+ require_relative 'helper'
2
+ require_relative '../lib/nelumba/binary.rb'
3
+
4
+ describe Nelumba::Binary do
5
+ describe "#initialize" do
6
+ it "should store an author" do
7
+ author = mock('author')
8
+ Nelumba::Binary.new(:author => author).author.must_equal author
9
+ end
10
+
11
+ it "should store content" do
12
+ Nelumba::Binary.new(:content => "txt").content.must_equal "txt"
13
+ end
14
+
15
+ it "should store the data" do
16
+ Nelumba::Binary.new(:data => "txt").data.must_equal "txt"
17
+ end
18
+
19
+ it "should store the compression" do
20
+ Nelumba::Binary.new(:compression => "txt").compression.must_equal "txt"
21
+ end
22
+
23
+ it "should store the md5" do
24
+ Nelumba::Binary.new(:md5 => "txt").md5.must_equal "txt"
25
+ end
26
+
27
+ it "should store the file url" do
28
+ Nelumba::Binary.new(:file_url => "txt").file_url.must_equal "txt"
29
+ end
30
+
31
+ it "should store the mime_type" do
32
+ Nelumba::Binary.new(:mime_type => "txt").mime_type.must_equal "txt"
33
+ end
34
+
35
+ it "should store the length" do
36
+ Nelumba::Binary.new(:length => "txt").length.must_equal "txt"
37
+ end
38
+
39
+ it "should store the published date" do
40
+ time = mock('date')
41
+ Nelumba::Binary.new(:published => time).published.must_equal time
42
+ end
43
+
44
+ it "should store the updated date" do
45
+ time = mock('date')
46
+ Nelumba::Binary.new(:updated => time).updated.must_equal time
47
+ end
48
+
49
+ it "should store a display name" do
50
+ Nelumba::Binary.new(:display_name => "url")
51
+ .display_name.must_equal "url"
52
+ end
53
+
54
+ it "should store a summary" do
55
+ Nelumba::Binary.new(:summary => "url").summary.must_equal "url"
56
+ end
57
+
58
+ it "should store a url" do
59
+ Nelumba::Binary.new(:url => "url").url.must_equal "url"
60
+ end
61
+
62
+ it "should store an id" do
63
+ Nelumba::Binary.new(:uid => "id").uid.must_equal "id"
64
+ end
65
+ end
66
+
67
+ describe "#to_hash" do
68
+ it "should contain the content" do
69
+ Nelumba::Binary.new(:content => "Hello")
70
+ .to_hash[:content].must_equal "Hello"
71
+ end
72
+
73
+ it "should contain the data" do
74
+ Nelumba::Binary.new(:data => "txt")
75
+ .to_hash[:data].must_equal "txt"
76
+ end
77
+
78
+ it "should contain the compression" do
79
+ Nelumba::Binary.new(:compression => "txt")
80
+ .to_hash[:compression].must_equal "txt"
81
+ end
82
+
83
+ it "should contain the md5" do
84
+ Nelumba::Binary.new(:md5 => "txt")
85
+ .to_hash[:md5].must_equal "txt"
86
+ end
87
+
88
+ it "should contain the file url" do
89
+ Nelumba::Binary.new(:file_url => "txt")
90
+ .to_hash[:file_url].must_equal "txt"
91
+ end
92
+
93
+ it "should contain the mime_type" do
94
+ Nelumba::Binary.new(:mime_type => "txt")
95
+ .to_hash[:mime_type].must_equal "txt"
96
+ end
97
+
98
+ it "should contain the length" do
99
+ Nelumba::Binary.new(:length => "txt")
100
+ .to_hash[:length].must_equal "txt"
101
+ end
102
+
103
+ it "should contain the author" do
104
+ author = mock('Nelumba::Person')
105
+ Nelumba::Binary.new(:author => author).to_hash[:author].must_equal author
106
+ end
107
+
108
+ it "should contain the uid" do
109
+ Nelumba::Binary.new(:uid => "Hello").to_hash[:uid].must_equal "Hello"
110
+ end
111
+
112
+ it "should contain the url" do
113
+ Nelumba::Binary.new(:url => "Hello").to_hash[:url].must_equal "Hello"
114
+ end
115
+
116
+ it "should contain the summary" do
117
+ Nelumba::Binary.new(:summary=> "Hello")
118
+ .to_hash[:summary].must_equal "Hello"
119
+ end
120
+
121
+ it "should contain the display name" do
122
+ Nelumba::Binary.new(:display_name => "Hello")
123
+ .to_hash[:display_name].must_equal "Hello"
124
+ end
125
+
126
+ it "should contain the published date" do
127
+ date = mock('Time')
128
+ Nelumba::Binary.new(:published => date).to_hash[:published].must_equal date
129
+ end
130
+
131
+ it "should contain the updated date" do
132
+ date = mock('Time')
133
+ Nelumba::Binary.new(:updated => date).to_hash[:updated].must_equal date
134
+ end
135
+ end
136
+
137
+ describe "#to_json" do
138
+ before do
139
+ author = Nelumba::Person.new :display_name => "wilkie"
140
+ @note = Nelumba::Binary.new :content => "Hello",
141
+ :author => author,
142
+ :data => "data",
143
+ :length => 125,
144
+ :compression => "foo",
145
+ :md5 => "hash",
146
+ :file_url => "file url",
147
+ :mime_type => "image/png",
148
+ :uid => "id",
149
+ :url => "url",
150
+ :title => "title",
151
+ :published => Time.now,
152
+ :updated => Time.now
153
+
154
+ @json = @note.to_json
155
+ @data = JSON.parse(@json)
156
+ end
157
+
158
+ it "should contain the embedded json for the author" do
159
+ @data["author"].must_equal JSON.parse(@note.author.to_json)
160
+ end
161
+
162
+ it "should contain the data" do
163
+ @data["data"].must_equal @note.data
164
+ end
165
+
166
+ it "should contain the compression" do
167
+ @data["compression"].must_equal @note.compression
168
+ end
169
+
170
+ it "should contain the md5" do
171
+ @data["md5"].must_equal @note.md5
172
+ end
173
+
174
+ it "should contain the file_url" do
175
+ @data["fileUrl"].must_equal @note.file_url
176
+ end
177
+
178
+ it "should contain the mime_type" do
179
+ @data["mimeType"].must_equal @note.mime_type
180
+ end
181
+
182
+ it "should contain the length" do
183
+ @data["length"].must_equal @note.length
184
+ end
185
+
186
+ it "should contain a 'binary' objectType" do
187
+ @data["objectType"].must_equal "binary"
188
+ end
189
+
190
+ it "should contain the id" do
191
+ @data["id"].must_equal @note.uid
192
+ end
193
+
194
+ it "should contain the content" do
195
+ @data["content"].must_equal @note.content
196
+ end
197
+
198
+ it "should contain the url" do
199
+ @data["url"].must_equal @note.url
200
+ end
201
+
202
+ it "should contain the summary" do
203
+ @data["summary"].must_equal @note.summary
204
+ end
205
+
206
+ it "should contain the display name" do
207
+ @data["displayName"].must_equal @note.display_name
208
+ end
209
+
210
+ it "should contain the published date as rfc3339" do
211
+ @data["published"].must_equal @note.published.to_date.rfc3339 + 'Z'
212
+ end
213
+
214
+ it "should contain the updated date as rfc3339" do
215
+ @data["updated"].must_equal @note.updated.to_date.rfc3339 + 'Z'
216
+ end
217
+ end
218
+ end