hentry_consumer 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ module HentryConsumer
15
15
  :url => self.url
16
16
  }
17
17
  }]
18
- }.to_json(*a)
18
+ }
19
19
  end
20
20
 
21
21
  end
@@ -21,14 +21,14 @@ module HentryConsumer
21
21
  :properties => {
22
22
  :name => self.name,
23
23
  :categories => self.categories,
24
- :author => self.author,
24
+ :author => self.author.map(&:to_json),
25
25
  :content => self.content,
26
26
  :bookmark => self.bookmark,
27
27
  :published_at => self.published_at,
28
28
  :summary => self.summary
29
29
  }
30
30
  }]
31
- }.to_json(*a)
31
+ }
32
32
  end
33
33
 
34
34
  private
@@ -19,12 +19,12 @@ module HentryConsumer
19
19
  end
20
20
 
21
21
  def to_json(*a)
22
- {:items =>
22
+ json = {:items =>
23
23
  [{
24
24
  :type => ["h-feed"],
25
- :properties => {:entries => self.entries}
25
+ :properties => {:entries => self.entries.map(&:to_json)}
26
26
  }]
27
- }.to_json(*a)
27
+ }
28
28
  end
29
29
 
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module HentryConsumer
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -59,17 +59,17 @@ describe HentryConsumer::HEntry do
59
59
  end
60
60
 
61
61
  describe "json" do
62
- let(:json) { JSON.parse(entry.to_json) }
62
+ let(:json) { entry.to_json }
63
63
 
64
- it { json["items"].should be_an_instance_of Array }
65
- it { json["items"].first["type"].should include 'h-entry'}
66
- it { json["items"].first["properties"]["name"].should eq ['Senior Cat Living']}
67
- it { json["items"].first["properties"]["content"].first.should match /Locations/ }
68
- it { json["items"].first["properties"]["author"].should be_an_instance_of Array }
69
- it { json["items"].first["properties"]["author"].first["items"].first["type"].should include "h-card" }
70
- it { json["items"].first["properties"]["bookmark"].should eq "http://g5.com/feed/entries/2012-08-26-20-09-0700" }
71
- it { json["items"].first["properties"]["published_at"].should eq ["2012-08-26 20:09-0700"] }
72
- it { json["items"].first["properties"]["summary"].should be_an_instance_of Array }
64
+ it { json[:items].should be_an_instance_of Array }
65
+ it { json[:items].first[:type].should include 'h-entry'}
66
+ it { json[:items].first[:properties][:name].should eq ['Senior Cat Living']}
67
+ it { json[:items].first[:properties][:content].first.should match /Locations/ }
68
+ it { json[:items].first[:properties][:author].should be_an_instance_of Array }
69
+ it { json[:items].first[:properties][:author].first[:items].first[:type].should include "h-card" }
70
+ it { json[:items].first[:properties][:bookmark].should eq "http://g5.com/feed/entries/2012-08-26-20-09-0700" }
71
+ it { json[:items].first[:properties][:published_at].should eq ["2012-08-26 20:09-0700"] }
72
+ it { json[:items].first[:properties][:summary].should be_an_instance_of Array }
73
73
  end
74
74
 
75
75
  end
@@ -4,12 +4,12 @@ describe HentryConsumer::HFeed do
4
4
  let(:feed) { HentryConsumer.parse(File.open("spec/support/example.html")) }
5
5
 
6
6
  describe "to json" do
7
- let(:json) { JSON.parse(feed.to_json) }
7
+ let(:json) { feed.to_json }
8
8
 
9
- it { json["items"].first["type"].should include 'h-feed'}
10
- it { json["items"].first["properties"]["entries"].should be_an_instance_of Array }
11
- it { json["items"].first["properties"]["entries"].first["items"].should be_an_instance_of Array }
12
- it { json["items"].first["properties"]["entries"].first["items"].first["type"].should include "h-entry" }
9
+ it { json[:items].first[:type].should include 'h-feed'}
10
+ it { json[:items].first[:properties][:entries].should be_an_instance_of Array }
11
+ it { json[:items].first[:properties][:entries].first[:items].should be_an_instance_of Array }
12
+ it { json[:items].first[:properties][:entries].first[:items].first[:type].should include "h-entry" }
13
13
 
14
14
  end
15
15
  # <article class=\"h-entry\"><h1 class=\"p-name\">Senior Cat Living</h1>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hentry_consumer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: