class Tubeclip::Parser::ContactsParser

Returns an array of the user's contacts

Public Instance Methods

parse_content(content) click to toggle source
# File lib/tubeclip/parser.rb, line 251
def parse_content(content)
  doc = Nokogiri::XML(content.body)
  feed = doc.at("feed")

  contacts = []
  feed.css("entry").each do |entry|
    temp_contact = Tubeclip::Model::Contact.new(
      :title    => entry.at("title") ? entry.at("title").text : nil,
      :username => entry.at_xpath("yt:username") ? entry.at_xpath("yt:username").text : nil,
      :status   => entry.at_xpath("yt:status") ? entry.at_xpath("yt:status").text : nil
    )

    contacts << temp_contact
  end

  return contacts
end