jameswilding-magpie 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/magpie/author.rb +19 -0
- data/lib/magpie/tweet.rb +2 -2
- metadata +2 -2
- data/lib/magpie/tweet/author.rb +0 -21
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Magpie
|
4
|
+
class Author
|
5
|
+
|
6
|
+
attr_reader :name, :uri, :image_uri
|
7
|
+
|
8
|
+
def initialize(xml)
|
9
|
+
@name = xml.search('author/name').inner_html
|
10
|
+
@uri = xml.search('author/uri').inner_html
|
11
|
+
@image_uri = xml.search('link[@rel="image"]').attr('href')
|
12
|
+
end
|
13
|
+
|
14
|
+
def inspect
|
15
|
+
"#<#{self.class}:#{object_id}>"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/magpie/tweet.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'nokogiri'
|
2
2
|
require 'cgi'
|
3
|
-
require File.join(File.dirname(__FILE__), '
|
3
|
+
require File.join(File.dirname(__FILE__), 'author')
|
4
4
|
|
5
5
|
module Magpie
|
6
6
|
class Tweet
|
@@ -25,7 +25,7 @@ module Magpie
|
|
25
25
|
@content = xml.search('content').inner_html
|
26
26
|
@published_at = DateTime.parse(xml.search('published').inner_html)
|
27
27
|
@uri = xml.search('link[@rel="alternate"]').attr('href')
|
28
|
-
@author = Author.new(xml)
|
28
|
+
@author = Magpie::Author.new(xml)
|
29
29
|
end
|
30
30
|
|
31
31
|
def inspect
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jameswilding-magpie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Wilding
|
@@ -32,9 +32,9 @@ extra_rdoc_files: []
|
|
32
32
|
|
33
33
|
files:
|
34
34
|
- lib/magpie.rb
|
35
|
+
- lib/magpie/author.rb
|
35
36
|
- lib/magpie/search.rb
|
36
37
|
- lib/magpie/tweet.rb
|
37
|
-
- lib/magpie/tweet/author.rb
|
38
38
|
has_rdoc: false
|
39
39
|
homepage: http://github.com/jameswilding/magpie/tree/master
|
40
40
|
post_install_message:
|
data/lib/magpie/tweet/author.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
|
3
|
-
module Magpie
|
4
|
-
class Tweet
|
5
|
-
class Author
|
6
|
-
|
7
|
-
attr_reader :name, :uri, :image_uri
|
8
|
-
|
9
|
-
def initialize(xml)
|
10
|
-
@name = xml.search('author/name').inner_html
|
11
|
-
@uri = xml.search('author/uri').inner_html
|
12
|
-
@image_uri = xml.search('link[@rel="image"]').attr('href')
|
13
|
-
end
|
14
|
-
|
15
|
-
def inspect
|
16
|
-
"#<#{self.class}:#{object_id}>"
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|