Sha256: a1205ff7ce242dd48b5a161f9d2a48c762c9c2697866a8cf1a77f2ca63b03bd1

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

# This is the page class for the topsy library. 
# A Page has the following attributes:
#      "page" : 1,
#      "total" : "1139",
#      "perpage" : 15,
#      "list" : Array of Author instances 
#
# According to the official Topsy doc: http://code.google.com/p/otterapi/wiki/Resources?tm=6#/authorsearch
#
module Topsy
  
  class Page < Hashie::Dash
    property :total
    property :list
    property :page
    property :perpage
    property :window
    property :topsy_trackback_url
    
    def to_s
      "Topsy Page: #{page} of #{total}, #{list.size} authors"
    end

    def initialize(content, klass)
      @klass = klass
      super(content)
    end
    
    def list=(value)
      result = []
      if value
        value.each{ |x| result << @klass.new(x) }
        self[:list] = result  
      else
        self[:list] = value
      end
    end
  end
 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
topsy-0.2.0 lib/topsy/page.rb