nelumba 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
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,149 @@
1
+ require_relative 'helper'
2
+ require_relative '../lib/nelumba/review.rb'
3
+
4
+ describe Nelumba::Review do
5
+ describe "#initialize" do
6
+ it "should store an author" do
7
+ author = mock('author')
8
+ Nelumba::Review.new(:author => author).author.must_equal author
9
+ end
10
+
11
+ it "should store content" do
12
+ Nelumba::Review.new(:content => "txt").content.must_equal "txt"
13
+ end
14
+
15
+ it "should store rating" do
16
+ Nelumba::Review.new(:rating => "txt").rating.must_equal "txt"
17
+ end
18
+
19
+ it "should store the published date" do
20
+ time = mock('date')
21
+ Nelumba::Review.new(:published => time).published.must_equal time
22
+ end
23
+
24
+ it "should store the updated date" do
25
+ time = mock('date')
26
+ Nelumba::Review.new(:updated => time).updated.must_equal time
27
+ end
28
+
29
+ it "should store a display name" do
30
+ Nelumba::Review.new(:display_name => "url")
31
+ .display_name.must_equal "url"
32
+ end
33
+
34
+ it "should store a summary" do
35
+ Nelumba::Review.new(:summary => "url").summary.must_equal "url"
36
+ end
37
+
38
+ it "should store a url" do
39
+ Nelumba::Review.new(:url => "url").url.must_equal "url"
40
+ end
41
+
42
+ it "should store an id" do
43
+ Nelumba::Review.new(:uid => "id").uid.must_equal "id"
44
+ end
45
+ end
46
+
47
+ describe "#to_hash" do
48
+ it "should contain the content" do
49
+ Nelumba::Review.new(:content => "Hello")
50
+ .to_hash[:content].must_equal "Hello"
51
+ end
52
+
53
+ it "should contain the author" do
54
+ author = mock('Nelumba::Person')
55
+ Nelumba::Review.new(:author => author).to_hash[:author].must_equal author
56
+ end
57
+
58
+ it "should contain the rating" do
59
+ Nelumba::Review.new(:rating => "Hello").to_hash[:rating].must_equal "Hello"
60
+ end
61
+
62
+ it "should contain the uid" do
63
+ Nelumba::Review.new(:uid => "Hello").to_hash[:uid].must_equal "Hello"
64
+ end
65
+
66
+ it "should contain the url" do
67
+ Nelumba::Review.new(:url => "Hello").to_hash[:url].must_equal "Hello"
68
+ end
69
+
70
+ it "should contain the summary" do
71
+ Nelumba::Review.new(:summary=> "Hello")
72
+ .to_hash[:summary].must_equal "Hello"
73
+ end
74
+
75
+ it "should contain the display name" do
76
+ Nelumba::Review.new(:display_name => "Hello")
77
+ .to_hash[:display_name].must_equal "Hello"
78
+ end
79
+
80
+ it "should contain the published date" do
81
+ date = mock('Time')
82
+ Nelumba::Review.new(:published => date).to_hash[:published].must_equal date
83
+ end
84
+
85
+ it "should contain the updated date" do
86
+ date = mock('Time')
87
+ Nelumba::Review.new(:updated => date).to_hash[:updated].must_equal date
88
+ end
89
+ end
90
+
91
+ describe "#to_json" do
92
+ before do
93
+ author = Nelumba::Person.new :display_name => "wilkie"
94
+ @note = Nelumba::Review.new :content => "Hello",
95
+ :author => author,
96
+ :rating => 123,
97
+ :uid => "id",
98
+ :url => "url",
99
+ :title => "title",
100
+ :summary => "foo",
101
+ :display_name => "meh",
102
+ :published => Time.now,
103
+ :updated => Time.now
104
+
105
+ @json = @note.to_json
106
+ @data = JSON.parse(@json)
107
+ end
108
+
109
+ it "should contain the embedded json for the author" do
110
+ @data["author"].must_equal JSON.parse(@note.author.to_json)
111
+ end
112
+
113
+ it "should contain a 'review' objectType" do
114
+ @data["objectType"].must_equal "review"
115
+ end
116
+
117
+ it "should contain the id" do
118
+ @data["id"].must_equal @note.uid
119
+ end
120
+
121
+ it "should contain the rating" do
122
+ @data["rating"].must_equal @note.rating
123
+ end
124
+
125
+ it "should contain the content" do
126
+ @data["content"].must_equal @note.content
127
+ end
128
+
129
+ it "should contain the url" do
130
+ @data["url"].must_equal @note.url
131
+ end
132
+
133
+ it "should contain the summary" do
134
+ @data["summary"].must_equal @note.summary
135
+ end
136
+
137
+ it "should contain the display name" do
138
+ @data["displayName"].must_equal @note.display_name
139
+ end
140
+
141
+ it "should contain the published date as rfc3339" do
142
+ @data["published"].must_equal @note.published.to_date.rfc3339 + 'Z'
143
+ end
144
+
145
+ it "should contain the updated date as rfc3339" do
146
+ @data["updated"].must_equal @note.updated.to_date.rfc3339 + 'Z'
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,136 @@
1
+ require_relative 'helper'
2
+ require_relative '../lib/nelumba/service.rb'
3
+
4
+ describe Nelumba::Service do
5
+ describe "#initialize" do
6
+ it "should store an author" do
7
+ author = mock('author')
8
+ Nelumba::Service.new(:author => author).author.must_equal author
9
+ end
10
+
11
+ it "should store content" do
12
+ Nelumba::Service.new(:content => "txt").content.must_equal "txt"
13
+ end
14
+
15
+ it "should store the published date" do
16
+ time = mock('date')
17
+ Nelumba::Service.new(:published => time).published.must_equal time
18
+ end
19
+
20
+ it "should store the updated date" do
21
+ time = mock('date')
22
+ Nelumba::Service.new(:updated => time).updated.must_equal time
23
+ end
24
+
25
+ it "should store a display name" do
26
+ Nelumba::Service.new(:display_name => "url")
27
+ .display_name.must_equal "url"
28
+ end
29
+
30
+ it "should store a summary" do
31
+ Nelumba::Service.new(:summary => "url").summary.must_equal "url"
32
+ end
33
+
34
+ it "should store a url" do
35
+ Nelumba::Service.new(:url => "url").url.must_equal "url"
36
+ end
37
+
38
+ it "should store an id" do
39
+ Nelumba::Service.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::Service.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::Service.new(:author => author).to_hash[:author].must_equal author
52
+ end
53
+
54
+ it "should contain the uid" do
55
+ Nelumba::Service.new(:uid => "Hello").to_hash[:uid].must_equal "Hello"
56
+ end
57
+
58
+ it "should contain the url" do
59
+ Nelumba::Service.new(:url => "Hello").to_hash[:url].must_equal "Hello"
60
+ end
61
+
62
+ it "should contain the summary" do
63
+ Nelumba::Service.new(:summary=> "Hello")
64
+ .to_hash[:summary].must_equal "Hello"
65
+ end
66
+
67
+ it "should contain the display name" do
68
+ Nelumba::Service.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::Service.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::Service.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::Service.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 'service' objectType" do
105
+ @data["objectType"].must_equal "service"
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,164 @@
1
+ require_relative 'helper'
2
+ require_relative '../lib/nelumba/video.rb'
3
+
4
+ describe Nelumba::Video do
5
+ describe "#initialize" do
6
+ it "should store an author" do
7
+ author = mock('author')
8
+ Nelumba::Video.new(:author => author).author.must_equal author
9
+ end
10
+
11
+ it "should store the stream" do
12
+ Nelumba::Video.new(:stream => "txt").stream.must_equal "txt"
13
+ end
14
+
15
+ it "should store the embed code" do
16
+ Nelumba::Video.new(:embed_code => "txt").embed_code.must_equal "txt"
17
+ end
18
+
19
+ it "should store content" do
20
+ Nelumba::Video.new(:content => "txt").content.must_equal "txt"
21
+ end
22
+
23
+ it "should store the published date" do
24
+ time = mock('date')
25
+ Nelumba::Video.new(:published => time).published.must_equal time
26
+ end
27
+
28
+ it "should store the updated date" do
29
+ time = mock('date')
30
+ Nelumba::Video.new(:updated => time).updated.must_equal time
31
+ end
32
+
33
+ it "should store a display name" do
34
+ Nelumba::Video.new(:display_name => "url")
35
+ .display_name.must_equal "url"
36
+ end
37
+
38
+ it "should store a summary" do
39
+ Nelumba::Video.new(:summary => "url").summary.must_equal "url"
40
+ end
41
+
42
+ it "should store a url" do
43
+ Nelumba::Video.new(:url => "url").url.must_equal "url"
44
+ end
45
+
46
+ it "should store an id" do
47
+ Nelumba::Video.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::Video.new(:stream => "txt")
54
+ .to_hash[:stream].must_equal "txt"
55
+ end
56
+
57
+ it "should contain the embed code" do
58
+ Nelumba::Video.new(:embed_code => "txt")
59
+ .to_hash[:embed_code].must_equal "txt"
60
+ end
61
+
62
+ it "should contain the content" do
63
+ Nelumba::Video.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::Video.new(:author => author).to_hash[:author].must_equal author
70
+ end
71
+
72
+ it "should contain the uid" do
73
+ Nelumba::Video.new(:uid => "Hello").to_hash[:uid].must_equal "Hello"
74
+ end
75
+
76
+ it "should contain the url" do
77
+ Nelumba::Video.new(:url => "Hello").to_hash[:url].must_equal "Hello"
78
+ end
79
+
80
+ it "should contain the summary" do
81
+ Nelumba::Video.new(:summary=> "Hello")
82
+ .to_hash[:summary].must_equal "Hello"
83
+ end
84
+
85
+ it "should contain the display name" do
86
+ Nelumba::Video.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::Video.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::Video.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::Video.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 'video' objectType" do
133
+ @data["objectType"].must_equal "video"
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