ostatus 0.0.4 → 0.0.5
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.
- data/lib/ostatus/entry.rb +29 -1
- data/lib/ostatus/feed.rb +9 -4
- data/lib/ostatus/version.rb +1 -1
- metadata +3 -3
data/lib/ostatus/entry.rb
CHANGED
@@ -70,6 +70,27 @@ module OStatus
|
|
70
70
|
pick_first_node(@entry.css('id'))
|
71
71
|
end
|
72
72
|
|
73
|
+
def url
|
74
|
+
return @entry_data[:url] unless @entry_data == nil or @entry_data[:url] == nil
|
75
|
+
return nil if @entry_data != nil
|
76
|
+
|
77
|
+
cur_url = nil
|
78
|
+
@entry.css('link').each do |node|
|
79
|
+
if node[:href]
|
80
|
+
cur_url = node[:href]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
links = self.link
|
85
|
+
if links[:alternate]
|
86
|
+
links[:alternate][0][:href]
|
87
|
+
elsif links[:self]
|
88
|
+
links[:self][0][:href]
|
89
|
+
else
|
90
|
+
cur_url
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
73
94
|
def link
|
74
95
|
return @entry_data[:link] unless @entry_data == nil
|
75
96
|
|
@@ -82,7 +103,14 @@ module OStatus
|
|
82
103
|
result[rel] = []
|
83
104
|
end
|
84
105
|
|
85
|
-
|
106
|
+
attrs = node.attributes
|
107
|
+
|
108
|
+
map = {}
|
109
|
+
attrs.keys.each do |key|
|
110
|
+
map[key.intern] = attrs[key]
|
111
|
+
end
|
112
|
+
|
113
|
+
result[rel] << map
|
86
114
|
end
|
87
115
|
end
|
88
116
|
|
data/lib/ostatus/feed.rb
CHANGED
@@ -45,7 +45,8 @@ module OStatus
|
|
45
45
|
# returns the contents of the href attribute.
|
46
46
|
#
|
47
47
|
def link(attribute)
|
48
|
-
return @options[:links][attribute] unless @options == nil
|
48
|
+
return @options[:links][attribute] unless @options == nil or @options[:links] == nil
|
49
|
+
return nil if @options != nil
|
49
50
|
|
50
51
|
# get all links with rel attribute being equal to attribute
|
51
52
|
@xml.xpath('/xmlns:feed/xmlns:link').select do |link|
|
@@ -55,8 +56,12 @@ module OStatus
|
|
55
56
|
|
56
57
|
# Returns an array of URLs for each hub link tag.
|
57
58
|
def hubs
|
58
|
-
link(:hub)
|
59
|
-
link
|
59
|
+
if link(:hub)
|
60
|
+
link(:hub).map do |link|
|
61
|
+
link[:href]
|
62
|
+
end
|
63
|
+
else
|
64
|
+
[]
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
@@ -107,7 +112,7 @@ module OStatus
|
|
107
112
|
)
|
108
113
|
|
109
114
|
@options[:entries].each do |entry|
|
110
|
-
entry_url = entry.
|
115
|
+
entry_url = entry.url
|
111
116
|
entry_url = @url if entry_url == nil
|
112
117
|
|
113
118
|
feed.add_entry(
|
data/lib/ostatus/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Hackers of the Severed Hand
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-22 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|