Sha256: 05f9aa107508e9a2b057922366228848ea5ce3f62373ea364810ac391ff95568

Contents?: true

Size: 759 Bytes

Versions: 31

Compression:

Stored size: 759 Bytes

Contents

require 'roar/representer/json'
require 'billit_representers/representers/table_representer'

module Billit
  module TableCollectionPageRepresenter
    include Roar::Representer::JSON
    include Roar::Representer::Feature::Hypermedia
   
    collection :tables, :extend => TableRepresenter, :class => Table

    property :total_entries
    property :current_page
    property :total_pages
   
    link :self do |params|
      url_for(params.merge(:page => current_page))
    end
   
    link :next do |params|
      url_for(params.merge(:page => next_page)) \
        if next_page
    end
   
    link :previous do |params|
      url_for(params.merge(:page => previous_page)) \
        if previous_page
    end
   
    def tables
      self
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
billit_representers-0.9.10 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.9 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.8 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.7 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.6 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.5 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.4 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.3 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.2 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.1 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.9.0 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.12 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.11 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.10 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.9 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.8 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.7 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.6 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.5 lib/billit_representers/representers/table_collection_page_representer.rb
billit_representers-0.8.4 lib/billit_representers/representers/table_collection_page_representer.rb