hummingbird-me/kitsu-server

View on GitHub
app/services/youtube_service/notification.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class YoutubeService
  class Notification
    attr_reader :atom

    def initialize(atom)
      @atom = atom.is_a?(String) ? Nokogiri::XML.parse(atom) : atom
    end

    def post!(user)
      entries.map { |entry| entry.post!(user) }
    end

    def entries
      atom.xpath('//xmlns:entry').map { |entry| NotificationEntry.new(entry) }
    end
  end
end