Skip to content

Commit

Permalink
support (and spec) for reading likes from a network_statuses call
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Vegas authored and Javier Vegas committed Feb 13, 2011
1 parent 337dca3 commit a17a453
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/linked_in/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ def profile
Profile.new(Nokogiri::XML(@doc.xpath('./update/update-content/person').to_xml))
end

def likes
Likes.new(Nokogiri::XML(@doc.xpath('./update/likes').to_xml)).likes
end

end
end
3 changes: 3 additions & 0 deletions spec/cases/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
stats.updates.first.profile.first_name.should == 'Vahid'
stats.updates.first.profile.connections.first.id.should == "28072758"
stats.updates.first.profile.connections.first.last_name.should == 'Varone'
stats.updates.first.likes.size.should == 2
stats.updates.first.likes.last.profile.first_name.should == 'Napoleon'
stats.updates.last.likes.should be_empty
end

it "should retrieve network updates" do
Expand Down
18 changes: 18 additions & 0 deletions spec/fixtures/network_statuses.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@
</person>
</update-content>
<is-commentable>true</is-commentable>
<likes total="2">
<like>
<person>
<id>POfcN6JhcU</id>
<first-name>George</first-name>
<last-name>Washington</last-name>
<headline>President, United States of America</headline>
</person>
</like>
<like>
<person>
<id>ROfcN6JhcW</id>
<first-name>Napoleon</first-name>
<last-name>Bonaparte</last-name>
<headline>Emperor, France</headline>
</person>
</like>
</likes>
</update>
<update>
<timestamp>1259134444850</timestamp>
Expand Down

0 comments on commit a17a453

Please sign in to comment.