Sha256: e506b0f16a5eb4182bae0c228128e5a3113cbd716afcf65064a5f39b10bebc87

Contents?: true

Size: 1005 Bytes

Versions: 2

Compression:

Stored size: 1005 Bytes

Contents

class GoogleAjax
  class Feed
    FEED_VERSION = 1.0
    def self.get(method, query, args = {})
      args = { :v => FEED_VERSION }.merge!(args)
      GoogleAjax::get(:feed, method, query, args)
    end
    
    # will return a list of feeds that match the given query
    def self.find(query, args = {})
      self.get(:find, query)
    end

    # downloads this feed from Google's servers
    # Optional: args { :num => number of entries to download(default is 4, maximum is 100) }
    def self.load(query, args = {})
      self.get(:load, query, args)
    end
    
    # will return the associated feed if it exists for a given url    
    def self.lookup(query, args = {})
      self.get(:lookup, query)
    end    
    
    class Entry < OpenStruct
      def initialize(data)
        super(data)
      end
    end    
    
    class Feed < OpenStruct
      def initialize(data)
        super(data)
        self.entries = entries.collect {|data| Entry.new(data)} if entries
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
monki-GoogleAjax-0.1.0 lib/googleajax/feed.rb
googleajax-0.1.0 lib/google_ajax/feed.rb