nelumba 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.travis.yml +9 -0
- data/Gemfile +20 -0
- data/README.md +242 -0
- data/Rakefile +7 -0
- data/assets/lotus_logo_purple.png +0 -0
- data/assets/lotus_logo_purple.svg +262 -0
- data/lib/nelumba.rb +47 -0
- data/lib/nelumba/activity.rb +250 -0
- data/lib/nelumba/application.rb +11 -0
- data/lib/nelumba/article.rb +11 -0
- data/lib/nelumba/atom/account.rb +50 -0
- data/lib/nelumba/atom/address.rb +56 -0
- data/lib/nelumba/atom/author.rb +176 -0
- data/lib/nelumba/atom/category.rb +41 -0
- data/lib/nelumba/atom/comment.rb +96 -0
- data/lib/nelumba/atom/entry.rb +216 -0
- data/lib/nelumba/atom/feed.rb +198 -0
- data/lib/nelumba/atom/generator.rb +40 -0
- data/lib/nelumba/atom/link.rb +79 -0
- data/lib/nelumba/atom/name.rb +57 -0
- data/lib/nelumba/atom/organization.rb +62 -0
- data/lib/nelumba/atom/person.rb +179 -0
- data/lib/nelumba/atom/portable_contacts.rb +117 -0
- data/lib/nelumba/atom/source.rb +179 -0
- data/lib/nelumba/atom/thread.rb +60 -0
- data/lib/nelumba/audio.rb +39 -0
- data/lib/nelumba/badge.rb +11 -0
- data/lib/nelumba/binary.rb +52 -0
- data/lib/nelumba/bookmark.rb +30 -0
- data/lib/nelumba/category.rb +49 -0
- data/lib/nelumba/collection.rb +34 -0
- data/lib/nelumba/comment.rb +47 -0
- data/lib/nelumba/crypto.rb +144 -0
- data/lib/nelumba/device.rb +11 -0
- data/lib/nelumba/discover.rb +362 -0
- data/lib/nelumba/event.rb +57 -0
- data/lib/nelumba/feed.rb +173 -0
- data/lib/nelumba/file.rb +43 -0
- data/lib/nelumba/generator.rb +53 -0
- data/lib/nelumba/group.rb +11 -0
- data/lib/nelumba/identity.rb +63 -0
- data/lib/nelumba/image.rb +30 -0
- data/lib/nelumba/link.rb +56 -0
- data/lib/nelumba/note.rb +34 -0
- data/lib/nelumba/notification.rb +229 -0
- data/lib/nelumba/object.rb +251 -0
- data/lib/nelumba/person.rb +306 -0
- data/lib/nelumba/place.rb +34 -0
- data/lib/nelumba/product.rb +30 -0
- data/lib/nelumba/publisher.rb +44 -0
- data/lib/nelumba/question.rb +30 -0
- data/lib/nelumba/review.rb +30 -0
- data/lib/nelumba/service.rb +11 -0
- data/lib/nelumba/subscription.rb +117 -0
- data/lib/nelumba/version.rb +3 -0
- data/lib/nelumba/video.rb +43 -0
- data/nelumba.gemspec +28 -0
- data/spec/activity_spec.rb +116 -0
- data/spec/application_spec.rb +136 -0
- data/spec/article_spec.rb +136 -0
- data/spec/atom/comment_spec.rb +455 -0
- data/spec/atom/feed_spec.rb +684 -0
- data/spec/audio_spec.rb +164 -0
- data/spec/badge_spec.rb +136 -0
- data/spec/binary_spec.rb +218 -0
- data/spec/bookmark.rb +150 -0
- data/spec/collection_spec.rb +152 -0
- data/spec/comment_spec.rb +128 -0
- data/spec/crypto_spec.rb +126 -0
- data/spec/device_spec.rb +136 -0
- data/spec/event_spec.rb +239 -0
- data/spec/feed_spec.rb +252 -0
- data/spec/file_spec.rb +190 -0
- data/spec/group_spec.rb +136 -0
- data/spec/helper.rb +10 -0
- data/spec/identity_spec.rb +67 -0
- data/spec/image_spec.rb +150 -0
- data/spec/link_spec.rb +30 -0
- data/spec/note_spec.rb +163 -0
- data/spec/notification_spec.rb +89 -0
- data/spec/person_spec.rb +244 -0
- data/spec/place_spec.rb +162 -0
- data/spec/product_spec.rb +150 -0
- data/spec/question_spec.rb +156 -0
- data/spec/review_spec.rb +149 -0
- data/spec/service_spec.rb +136 -0
- data/spec/video_spec.rb +164 -0
- data/test/example_feed.atom +393 -0
- data/test/example_feed_empty_author.atom +336 -0
- data/test/example_feed_false_connected.atom +359 -0
- data/test/example_feed_link_without_href.atom +134 -0
- data/test/example_page.html +4 -0
- data/test/mime_type_bug_feed.atom +874 -0
- metadata +288 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
module Nelumba
|
2
|
+
class Event
|
3
|
+
include Nelumba::Object
|
4
|
+
|
5
|
+
attr_reader :attending
|
6
|
+
attr_reader :maybe_attending
|
7
|
+
attr_reader :not_attending
|
8
|
+
|
9
|
+
attr_reader :start_time
|
10
|
+
attr_reader :end_time
|
11
|
+
|
12
|
+
attr_reader :location
|
13
|
+
|
14
|
+
def initialize(options = {}, &blk)
|
15
|
+
init(options, &blk)
|
16
|
+
end
|
17
|
+
|
18
|
+
def init(options = {}, &blk)
|
19
|
+
super options
|
20
|
+
|
21
|
+
@attending = options[:attending] || []
|
22
|
+
@maybe_attending = options[:maybe_attending] || []
|
23
|
+
@not_attending = options[:not_attending] || []
|
24
|
+
@start_time = options[:start_time]
|
25
|
+
@end_time = options[:end_time]
|
26
|
+
@location = options[:location]
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_hash
|
30
|
+
{
|
31
|
+
:attending => @attending.dup,
|
32
|
+
:maybe_attending => @maybe_attending.dup,
|
33
|
+
:not_attending => @not_attending.dup,
|
34
|
+
|
35
|
+
:start_time => @start_time,
|
36
|
+
:end_time => @end_time,
|
37
|
+
|
38
|
+
:location => @location
|
39
|
+
}.merge(super)
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_json_hash
|
43
|
+
{
|
44
|
+
:objectType => "event",
|
45
|
+
|
46
|
+
:attending => @attending.dup,
|
47
|
+
:maybeAttending => @maybe_attending.dup,
|
48
|
+
:notAttending => @not_attending.dup,
|
49
|
+
|
50
|
+
:startTime => (@start_time && @start_time.to_date.rfc3339 + 'Z'),
|
51
|
+
:endTime => (@end_time && @end_time.to_date.rfc3339 + 'Z'),
|
52
|
+
|
53
|
+
:location => @location
|
54
|
+
}.merge(super)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/nelumba/feed.rb
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
module Nelumba
|
2
|
+
# This class represents a Nelumba::Feed object.
|
3
|
+
class Feed < Nelumba::Collection
|
4
|
+
require 'open-uri'
|
5
|
+
require 'date'
|
6
|
+
|
7
|
+
# Holds the list of categories for this feed as Nelumba::Category.
|
8
|
+
attr_reader :categories
|
9
|
+
|
10
|
+
# Holds human-readable information about the content rights of the entries
|
11
|
+
# in the feed without an explicit rights field of their own. SHOULD NOT be
|
12
|
+
# machine interpreted.
|
13
|
+
attr_reader :rights
|
14
|
+
|
15
|
+
# Holds the title for this feed.
|
16
|
+
attr_reader :title
|
17
|
+
|
18
|
+
# Holds the content-type for the title.
|
19
|
+
attr_reader :title_type
|
20
|
+
|
21
|
+
# Holds the subtitle for this feed.
|
22
|
+
attr_reader :subtitle
|
23
|
+
|
24
|
+
# Holds the content-type for the subtitle.
|
25
|
+
attr_reader :subtitle_type
|
26
|
+
|
27
|
+
# Holds the URL for the icon representing this feed.
|
28
|
+
attr_reader :icon
|
29
|
+
|
30
|
+
# Holds the URL for the logo representing this feed.
|
31
|
+
attr_reader :logo
|
32
|
+
|
33
|
+
# Holds the generator for this content as an Nelumba::Generator.
|
34
|
+
attr_reader :generator
|
35
|
+
|
36
|
+
# Holds the list of contributors, if any, that are involved in this feed
|
37
|
+
# as Nelumba::Person.
|
38
|
+
attr_reader :contributors
|
39
|
+
|
40
|
+
# Holds the list of authors as Nelumba::Person responsible for this feed.
|
41
|
+
attr_reader :authors
|
42
|
+
|
43
|
+
# Holds the list of hubs that are available to manage subscriptions to this
|
44
|
+
# feed.
|
45
|
+
attr_reader :hubs
|
46
|
+
|
47
|
+
# Holds the salmon url that handles notifications for this feed.
|
48
|
+
attr_reader :salmon_url
|
49
|
+
|
50
|
+
# Holds links to other resources as an array of Nelumba::Link
|
51
|
+
attr_reader :links
|
52
|
+
|
53
|
+
# Creates a new representation of a feed.
|
54
|
+
#
|
55
|
+
# options:
|
56
|
+
# uid => The unique identifier for this feed.
|
57
|
+
# url => The url that represents this feed.
|
58
|
+
# title => The title for this feed. Defaults: "Untitled"
|
59
|
+
# title_type => The content type for the title.
|
60
|
+
# subtitle => The subtitle for this feed.
|
61
|
+
# subtitle_type => The content type for the subtitle.
|
62
|
+
# authors => The list of Nelumba::Person's for this feed.
|
63
|
+
# Defaults: []
|
64
|
+
# contributors => The list of Nelumba::Person's that contributed to this
|
65
|
+
# feed. Defaults: []
|
66
|
+
# items => The list of Nelumba::Activity's for this feed.
|
67
|
+
# Defaults: []
|
68
|
+
# icon => The url of the icon that represents this feed. It
|
69
|
+
# should have an aspect ratio of 1 horizontal to 1
|
70
|
+
# vertical and optimized for presentation at a
|
71
|
+
# small size.
|
72
|
+
# logo => The url of the logo that represents this feed. It
|
73
|
+
# should have an aspect ratio of 2 horizontal to 1
|
74
|
+
# vertical.
|
75
|
+
# categories => An array of Nelumba::Category's that describe how to
|
76
|
+
# categorize and describe the content of the feed.
|
77
|
+
# Defaults: []
|
78
|
+
# rights => A String depicting the rights of items without
|
79
|
+
# explicit rights of their own. SHOULD NOT be machine
|
80
|
+
# interpreted.
|
81
|
+
# updated => The DateTime representing when this feed was last
|
82
|
+
# modified.
|
83
|
+
# published => The DateTime representing when this feed was originally
|
84
|
+
# published.
|
85
|
+
# salmon_url => The url of the salmon endpoint, if one exists, for this
|
86
|
+
# feed.
|
87
|
+
# links => An array of Nelumba::Link that adds relations to other
|
88
|
+
# resources.
|
89
|
+
# generator => A Nelumba::Generator representing the agent
|
90
|
+
# responsible for generating this feed.
|
91
|
+
#
|
92
|
+
# Usage:
|
93
|
+
#
|
94
|
+
# author = Nelumba::Person.new(:name => "Kelly")
|
95
|
+
#
|
96
|
+
# feed = Nelumba::Feed.new(:title => "My Feed",
|
97
|
+
# :uid => "1",
|
98
|
+
# :url => "http://example.com/feeds/1",
|
99
|
+
# :authors => [author])
|
100
|
+
def initialize(options = {}, &blk)
|
101
|
+
init(options, &blk)
|
102
|
+
end
|
103
|
+
|
104
|
+
def init(options = {})
|
105
|
+
super options
|
106
|
+
|
107
|
+
@icon = options[:icon]
|
108
|
+
@logo = options[:logo]
|
109
|
+
@rights = options[:rights]
|
110
|
+
@title = options[:title] || "Untitled"
|
111
|
+
@title_type = options[:title_type]
|
112
|
+
@subtitle = options[:subtitle]
|
113
|
+
@subtitle_type = options[:subtitle_type]
|
114
|
+
@authors = options[:authors] || []
|
115
|
+
@categories = options[:categories] || []
|
116
|
+
@contributors = options[:contributors] || []
|
117
|
+
@salmon_url = options[:salmon_url]
|
118
|
+
@hubs = options[:hubs] || []
|
119
|
+
@generator = options[:generator]
|
120
|
+
end
|
121
|
+
|
122
|
+
# Yields a Nelumba::Link to this feed.
|
123
|
+
#
|
124
|
+
# options: Can override Nelumba::Link properties, such as rel.
|
125
|
+
#
|
126
|
+
# Usage:
|
127
|
+
#
|
128
|
+
# feed = Nelumba::Feed.new(:title => "Foo", :url => "http://example.com")
|
129
|
+
# feed.to_link(:rel => "alternate", :title => "Foo's Feed")
|
130
|
+
#
|
131
|
+
# Generates a link with:
|
132
|
+
# <Nelumba::Link rel="alternate" title="Foo's Feed" url="http://example.com">
|
133
|
+
def to_link(options = {})
|
134
|
+
options = { :title => self.title,
|
135
|
+
:href => self.url }.merge(options)
|
136
|
+
|
137
|
+
Nelumba::Link.new(options)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Returns a hash of the properties of the feed.
|
141
|
+
def to_hash
|
142
|
+
{
|
143
|
+
:hubs => (self.hubs || []).dup,
|
144
|
+
:icon => self.icon,
|
145
|
+
:logo => self.logo,
|
146
|
+
:rights => self.rights,
|
147
|
+
:title => self.title,
|
148
|
+
:title_type => self.title_type,
|
149
|
+
:subtitle => self.subtitle,
|
150
|
+
:subtitle_type => self.subtitle_type,
|
151
|
+
:authors => (self.authors || []).dup,
|
152
|
+
:categories => (self.categories || []).dup,
|
153
|
+
:contributors => (self.contributors || []).dup,
|
154
|
+
:updated => self.updated,
|
155
|
+
:salmon_url => self.salmon_url,
|
156
|
+
:published => self.published,
|
157
|
+
:generator => self.generator
|
158
|
+
}.merge(super)
|
159
|
+
end
|
160
|
+
|
161
|
+
def to_json_hash
|
162
|
+
{
|
163
|
+
}.merge(super)
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns a string containing an Atom representation of the feed.
|
167
|
+
def to_atom
|
168
|
+
require 'nelumba/atom/feed'
|
169
|
+
|
170
|
+
Nelumba::Atom::Feed.from_canonical(self).to_xml
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
data/lib/nelumba/file.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
module Nelumba
|
2
|
+
class File
|
3
|
+
include Nelumba::Object
|
4
|
+
|
5
|
+
attr_reader :file_url
|
6
|
+
attr_reader :mime_type
|
7
|
+
|
8
|
+
attr_reader :length
|
9
|
+
attr_reader :md5
|
10
|
+
|
11
|
+
def initialize(options = {}, &blk)
|
12
|
+
init(options, &blk)
|
13
|
+
end
|
14
|
+
|
15
|
+
def init(options = {}, &blk)
|
16
|
+
super options
|
17
|
+
|
18
|
+
@md5 = options[:md5]
|
19
|
+
@file_url = options[:file_url]
|
20
|
+
@mime_type = options[:mime_type]
|
21
|
+
@length = options[:length]
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_hash
|
25
|
+
{
|
26
|
+
:md5 => @md5,
|
27
|
+
:file_url => @file_url,
|
28
|
+
:mime_type => @mime_type,
|
29
|
+
:length => @length
|
30
|
+
}.merge(super)
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_json_hash
|
34
|
+
{
|
35
|
+
:objectType => "file",
|
36
|
+
:md5 => @md5,
|
37
|
+
:fileUrl => @file_url,
|
38
|
+
:mimeType => @mime_type,
|
39
|
+
:length => @length
|
40
|
+
}.merge(super)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Nelumba
|
2
|
+
# The generator element identifies the agent used to generate the feed.
|
3
|
+
class Generator
|
4
|
+
# Holds the base URI for relative URIs contained in uri.
|
5
|
+
attr_reader :base
|
6
|
+
|
7
|
+
# Holds the language of the name, when it exists. The language
|
8
|
+
# should be specified as RFC 3066 as either 2 or 3 letter codes.
|
9
|
+
# For example: 'en' for English or more specifically 'en-us'
|
10
|
+
attr_reader :lang
|
11
|
+
|
12
|
+
# Holds the optional uri that SHOULD produce a representation that is
|
13
|
+
# relevant to the agent.
|
14
|
+
attr_reader :uri
|
15
|
+
|
16
|
+
# Holds the optional string identifying the version of the generating
|
17
|
+
# agent.
|
18
|
+
attr_reader :version
|
19
|
+
|
20
|
+
# Holds the string that provides a human-readable name that identifies
|
21
|
+
# the generating agent. The content of this field is language sensitive.
|
22
|
+
attr_reader :name
|
23
|
+
|
24
|
+
# Creates a representation of a generator.
|
25
|
+
#
|
26
|
+
# options:
|
27
|
+
# :base => Optional base URI for use with a relative URI in uri.
|
28
|
+
# :lang => Optional string identifying the language of the name field.
|
29
|
+
# :uri => Optional string identifying the URL that SHOULD produce
|
30
|
+
# a representation that is relevant to the agent.
|
31
|
+
# :version => Optional string indicating the version of the generating
|
32
|
+
# agent.
|
33
|
+
# :name => Optional name of the agent.
|
34
|
+
def initialize(options = {})
|
35
|
+
@base = options[:base]
|
36
|
+
@lang = options[:lang]
|
37
|
+
@uri = options[:uri]
|
38
|
+
@version = options[:version]
|
39
|
+
@name = options[:name]
|
40
|
+
end
|
41
|
+
|
42
|
+
# Yields a hash that represents the generator.
|
43
|
+
def to_hash
|
44
|
+
{
|
45
|
+
:base => self.base,
|
46
|
+
:lang => self.lang,
|
47
|
+
:version => self.version,
|
48
|
+
:uri => self.uri,
|
49
|
+
:name => self.name
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Nelumba
|
2
|
+
# Holds information about an Identity. This is more specific to identifying
|
3
|
+
# an Person than that structure. It is generally hosted in one place and
|
4
|
+
# not replicated. It holds identifying information that allow you to
|
5
|
+
# ensure verification of communication with the author.
|
6
|
+
class Identity
|
7
|
+
# Holds the public key for this identity.
|
8
|
+
attr_reader :public_key
|
9
|
+
|
10
|
+
# Holds the salmon endpoint used for direct notifications for this
|
11
|
+
# identity.
|
12
|
+
attr_reader :salmon_endpoint
|
13
|
+
|
14
|
+
# Holds the dialback endpoint used for capability transfer and
|
15
|
+
# authentication for this identity.
|
16
|
+
attr_reader :dialback_endpoint
|
17
|
+
|
18
|
+
# Holds the activity streams inbox endpoint for this identity.
|
19
|
+
attr_reader :activity_inbox_endpoint
|
20
|
+
|
21
|
+
# Holds the activity streams outbox endpoint for this identity.
|
22
|
+
attr_reader :activity_outbox_endpoint
|
23
|
+
|
24
|
+
# Holds the url to this identity's profile.
|
25
|
+
attr_reader :profile_page
|
26
|
+
|
27
|
+
# Create an instance of an Identity.
|
28
|
+
#
|
29
|
+
# options:
|
30
|
+
# :public_key => The identity's public key.
|
31
|
+
# :salmon_endpoint => The salmon endpoint for this identity.
|
32
|
+
# :dialback_endpoint => The dialback endpoint for this identity.
|
33
|
+
# :activity_inbox_endpoint => The activity streams inbox for this
|
34
|
+
# identity.
|
35
|
+
# :activity_outbox_endpoint => The activity streams outbox for this
|
36
|
+
# identity.
|
37
|
+
# :profile_page => The url for this identity's profile page.
|
38
|
+
def initialize(options = {})
|
39
|
+
init(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def init(options = {})
|
43
|
+
@public_key = options[:public_key]
|
44
|
+
@salmon_endpoint = options[:salmon_endpoint]
|
45
|
+
@dialback_endpoint = options[:dialback_endpoint]
|
46
|
+
@activity_inbox_endpoint = options[:activity_inbox_endpoint]
|
47
|
+
@activity_outbox_endpoint = options[:activity_outbox_endpoint]
|
48
|
+
@profile_page = options[:profile_page]
|
49
|
+
end
|
50
|
+
|
51
|
+
# Returns a hash of the properties of the identity.
|
52
|
+
def to_hash
|
53
|
+
{
|
54
|
+
:public_key => self.public_key,
|
55
|
+
:salmon_endpoint => self.salmon_endpoint,
|
56
|
+
:dialback_endpoint => self.dialback_endpoint,
|
57
|
+
:activity_inbox_endpoint => self.activity_inbox_endpoint,
|
58
|
+
:activity_outbox_endpoint => self.activity_outbox_endpoint,
|
59
|
+
:profile_page => self.profile_page
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Nelumba
|
2
|
+
class Image
|
3
|
+
include Nelumba::Object
|
4
|
+
|
5
|
+
attr_reader :full_image
|
6
|
+
|
7
|
+
def initialize(options = {}, &blk)
|
8
|
+
init(options, &blk)
|
9
|
+
end
|
10
|
+
|
11
|
+
def init(options = {}, &blk)
|
12
|
+
super(options, &blk)
|
13
|
+
|
14
|
+
@full_image = options[:full_image]
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_hash
|
18
|
+
{
|
19
|
+
:full_image => @full_image
|
20
|
+
}.merge(super)
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_json_hash
|
24
|
+
{
|
25
|
+
:objectType => "image",
|
26
|
+
:fullImage => @full_image
|
27
|
+
}.merge(super)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/nelumba/link.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Nelumba
|
2
|
+
require 'atom'
|
3
|
+
|
4
|
+
class Link
|
5
|
+
# The URL for the related resource.
|
6
|
+
attr_reader :href
|
7
|
+
|
8
|
+
# A string indicating the relationship type with the current
|
9
|
+
# document.
|
10
|
+
#
|
11
|
+
# Standard:
|
12
|
+
# "alternate" = Signifies that the URL in href identifies an alternative
|
13
|
+
# version of the resource described by the containing
|
14
|
+
# element.
|
15
|
+
# "related" = Signifies that the URL in href identifies a resource that
|
16
|
+
# is related to the contained resource. For example, the
|
17
|
+
# feed for a site that discusses the performance of the
|
18
|
+
# search engine at "http://search.example.com" might
|
19
|
+
# contain, as a link of Feed, a related link to that
|
20
|
+
# "http://search.example.com".
|
21
|
+
# "self" = Signifies that href contains a URL to the containing
|
22
|
+
# resource.
|
23
|
+
# "enclosure" = Signifies that the URL in href identifies a related
|
24
|
+
# resource that is potentially large in size and
|
25
|
+
# require special handling. SHOULD use the length field.
|
26
|
+
# "via" = Signifies that the URL in href identifies a resource that
|
27
|
+
# is the source of the information provided in the
|
28
|
+
# containing element.
|
29
|
+
attr_reader :rel
|
30
|
+
|
31
|
+
# Advises to the content MIME type of the linked resource.
|
32
|
+
attr_reader :type
|
33
|
+
|
34
|
+
# Advises to the language of the linked resource. When used with
|
35
|
+
# rel="alternate" it depicts a translated version of the entry.
|
36
|
+
# Use with a RFC3066 language tag.
|
37
|
+
attr_reader :hreflang
|
38
|
+
|
39
|
+
# Conveys human-readable information about the linked resource.
|
40
|
+
attr_reader :title
|
41
|
+
|
42
|
+
# Advises the length of the linked content in number of bytes. It is simply
|
43
|
+
# a hint about the length based upon prior information. It may change, and
|
44
|
+
# cannot override the actual content length.
|
45
|
+
attr_reader :length
|
46
|
+
|
47
|
+
def initialize(options = {})
|
48
|
+
@href = options[:href]
|
49
|
+
@rel = options[:rel]
|
50
|
+
@type = options[:type]
|
51
|
+
@hreflang = options[:hreflang]
|
52
|
+
@title = options[:title]
|
53
|
+
@length = options[:length]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|