Skip to content
Extraits de code Groupes Projets
Valider 449a6f3e rédigé par maxwell's avatar maxwell
Parcourir les fichiers

MS IZ removed a refrence to REDFINGER

parent a22060d1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
# the COPYRIGHT file. # the COPYRIGHT file.
module HCard module HCard
def self.fetch url
Nokogiri::HTML(Net::HTTP.get URI.parse(url))
end
def self.parse doc def self.parse doc
{ {
:given_name => doc.css(".given_name").text, :given_name => doc.css(".given_name").text,
...@@ -16,10 +12,6 @@ module HCard ...@@ -16,10 +12,6 @@ module HCard
} }
end end
def self.find url
self.parse self.fetch(url)
end
def self.build(raw_hcard) def self.build(raw_hcard)
self.parse Nokogiri::HTML(raw_hcard) self.parse Nokogiri::HTML(raw_hcard)
end end
......
...@@ -6,10 +6,9 @@ require 'spec_helper' ...@@ -6,10 +6,9 @@ require 'spec_helper'
require File.join(Rails.root, 'lib/hcard') require File.join(Rails.root, 'lib/hcard')
describe HCard do describe HCard do
it 'should retreive and parse an hcard' do it 'should parse an hcard' do
stub_success("tom@tom.joindiaspora.com") raw_hcard = hcard_response
f = Redfinger.finger('tom@tom.joindiaspora.com') hcard = HCard.build raw_hcard
hcard = HCard.find f.hcard.first[:href]
hcard[:family_name].include?("Hamiltom").should be true hcard[:family_name].include?("Hamiltom").should be true
hcard[:given_name].include?("Alex").should be true hcard[:given_name].include?("Alex").should be true
hcard[:photo].include?("tom.jpg").should be true hcard[:photo].include?("tom.jpg").should be true
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter