Browse files

LinkedIn::Connections tests pass

  • Loading branch information...
1 parent e4ae1c8 commit a1881d1e55bea6655cff4aee5c59bc28535e80d3 Brad Cantin committed Jun 28, 2010
Showing with 17 additions and 19 deletions.
  1. +11 −11 lib/linked_in/connections.rb
  2. +0 −1 lib/linked_in/profile.rb
  3. +6 −7 test/client_test.rb
View
22 lib/linked_in/connections.rb
@@ -1,19 +1,15 @@
module LinkedIn
class Connections
- # include ROXML
- # xml_convention {|val| val.gsub("_","-") }
- # xml_reader :profiles, :as => [Profile], :from => 'person'
-
- # def self.from_xml(doc)
- # new(Nokogiri::XML(doc))
- # end
-
+
+ def self.from_xml(doc)
+ new(Nokogiri::XML(doc))
+ end
+
def initialize(doc)
@doc = doc
end
-
+
def connections
- # puts @doc.children
@arry ||= begin
connections = @doc.xpath('//connections')
@arry = []
@@ -24,5 +20,9 @@ def connections
end
end
+ def profiles
+ connections
+ end
+
end
-end
+end
View
1 lib/linked_in/profile.rb
@@ -3,7 +3,6 @@ class Profile
# xml_reader :location, :as => Location
# xml_reader :relation_to_viewer, :as => {:key => :name, :value => :content}
- # xml_reader :connections, :as => [Profile], :from => "connections/person"
# xml_reader :three_current_positions, :as => [Position]
# xml_reader :member_url_resources, :as => [UrlResource], :from => 'member-url-resources/member-url'
View
13 test/client_test.rb
@@ -34,7 +34,6 @@ class ClientTest < Test::Unit::TestCase
p.connections.size.should == 146
p.connections.first.first_name.should == "Ali"
- # puts p.connections.first.inspect
end
should "retrieve a profile for a member by id" do
@@ -56,12 +55,12 @@ class ClientTest < Test::Unit::TestCase
p.last_name.should == 'Netherland'
end
- # should "retrieve connections for the authenticated user" do
- # stub_get("/v1/people/~/connections", "connections.xml")
- # cons = @linkedin.connections
- # cons.size.should == 146
- # cons.last.last_name.should == 'Yuchnewicz'
- # end
+ should "retrieve connections for the authenticated user" do
+ stub_get("/v1/people/~/connections", "connections.xml")
+ cons = @linkedin.connections
+ cons.size.should == 146
+ cons.last.last_name.should == 'Yuchnewicz'
+ end
# should "perform a search by keyword" do
# stub_get("/v1/people?keywords=github", "search.xml")

0 comments on commit a1881d1

Please sign in to comment.