Sha256: 3e4c734cade39f54fc2b56039191aaa17a6ca71388beb6225e8673f8deb2fe03

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require 'roar/representer'
require 'roar/representer/feature/http_verbs'
require 'roar/representer/feature/client'
require 'roar/representer/json'
require 'roar/representer/json/hal'
# require 'roar/rails/hal'
require 'billit_representers/representers/count_representer'
require 'billit_representers/representers/vote_representer'
require 'billit_representers/models/count'
require 'billit_representers/models/vote'

module Billit
  module VoteEventRepresenter
    include Roar::Representer::JSON::HAL

    module Initializer
      def initialize
        extend Billit::VoteEventRepresenter
        extend Roar::Representer::Feature::Client
        super
      end
    end

    def self.included(klass)
      klass.send :prepend, Initializer
      klass.send :include, Roar::Representer::Feature::HttpVerbs
    end

    property :start_date
    property :end_date

    collection :counts, extend: Billit::CountRepresenter, class: lambda { |x, *| Object.const_defined?("Count") ? Count : BillitCount }
    collection :votes, extend: Billit::VoteRepresenter, class: lambda { |x, *| Object.const_defined?("Vote") ? Vote : BillitVote }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
billit_representers-0.9.10 lib/billit_representers/representers/vote_event_representer.rb
billit_representers-0.9.9 lib/billit_representers/representers/vote_event_representer.rb
billit_representers-0.9.8 lib/billit_representers/representers/vote_event_representer.rb
billit_representers-0.9.7 lib/billit_representers/representers/vote_event_representer.rb