ostatus 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,7 @@
1
1
  require 'nokogiri'
2
2
 
3
- module OStatus
4
- end
3
+ require_relative 'ostatus/feed'
4
+ require_relative 'ostatus/entry'
5
+ require_relative 'ostatus/author'
6
+ require_relative 'ostatus/activity'
7
+ require_relative 'ostatus/portable_contacts'
@@ -3,12 +3,14 @@ require 'open-uri'
3
3
  require 'tinyatom'
4
4
 
5
5
  require_relative 'entry'
6
+ require_relative 'author'
6
7
 
7
8
  module OStatus
8
9
 
9
10
  # This class represents an OStatus Feed object.
10
11
  class Feed
11
- def initialize(url, access_token, author, entries, id, title, links)
12
+ def initialize(str, url, access_token, author, entries, id, title, links)
13
+ @str = str
12
14
  @url = url
13
15
  @access_token = access_token
14
16
  @author = author
@@ -25,13 +27,17 @@ module OStatus
25
27
  # Creates a new Feed instance given by the atom feed located at 'url'
26
28
  # and optionally using the OAuth::AccessToken given.
27
29
  def Feed.from_url(url, access_token = nil)
28
- Feed.new(url, access_token, nil, nil, nil, nil, nil)
30
+ Feed.new(nil, url, access_token, nil, nil, nil, nil, nil)
29
31
  end
30
32
 
31
33
  # Creates a new Feed instance that contains the information given by
32
34
  # the various instances of author and entries.
33
35
  def Feed.from_data(id, title, url, author, entries, links)
34
- Feed.new(url, nil, author, entries, id, title, links)
36
+ Feed.new(nil, url, nil, author, entries, id, title, links)
37
+ end
38
+
39
+ def Feed.from_string(str)
40
+ Feed.new(str, nil, nil, nil, nil, nil, nil, nil)
35
41
  end
36
42
 
37
43
  # Returns an array of Nokogiri::XML::Element instances for all link tags
@@ -67,7 +73,9 @@ module OStatus
67
73
  # the atom feed. It will make a network request (through OAuth if
68
74
  # an access token was given) to retrieve the document if necessary.
69
75
  def atom
70
- if @id == nil and @access_token == nil
76
+ if @str != nil
77
+ @str
78
+ elsif @id == nil and @access_token == nil
71
79
  # simply open the url
72
80
  open(@url).read
73
81
  elsif @id == nil and @url != nil
@@ -93,7 +101,9 @@ module OStatus
93
101
  entry.title,
94
102
  entry.updated,
95
103
 
96
- '',
104
+ @url,
105
+
106
+ :published => entry.published,
97
107
 
98
108
  :content => entry.content,
99
109
 
@@ -1,3 +1,3 @@
1
1
  module OStatus
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -79,9 +79,8 @@ describe OStatus::Entry do
79
79
  @entry.info[:content_type].should eql("html")
80
80
  end
81
81
 
82
- it "should contain a Nokogiri NodeSet for the link" do
83
- @entry.info[:link].class.should eql(Nokogiri::XML::NodeSet)
84
- @entry.info[:link][0].class.should eql(Nokogiri::XML::Element)
82
+ it "should contain a Hash for the link" do
83
+ @entry.info[:link].class.should eql(Hash)
85
84
  end
86
85
 
87
86
  it "should contain the published DateTime" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Hackers of the Severed Hand