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