Skip to content

Commit

Permalink
LinkedIn::Connections tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Cantin committed Jun 28, 2010
1 parent e4ae1c8 commit a1881d1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
22 changes: 11 additions & 11 deletions lib/linked_in/connections.rb
Original file line number Diff line number Diff line change
@@ -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 = []
Expand All @@ -24,5 +20,9 @@ def connections
end
end

def profiles
connections
end

end
end
end
1 change: 0 additions & 1 deletion lib/linked_in/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
13 changes: 6 additions & 7 deletions test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit a1881d1

Please sign in to comment.