Sha256: 0ba24040abadf882e5e12ff8f60f6c4a47e5053dfd92a9712d3394c110258242

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

module WeThePeople
  module Resources
    class Petition < WeThePeople::Resource
      attribute :id
      attribute :type
      attribute :title
      attribute :body
      attribute :status
      attribute :signature_threshold, Integer
      attribute :signature_count, Integer
      attribute :signatures_needed, Integer
      attribute :deadline, Time
      attribute :created, Time

      has_embedded :response
      has_many_embedded :issues

      has_many :signatures

      def successful?
        signatures_needed == 0
      end

      def failed?
        deadline < Time.now && !successful?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
we_the_people-0.0.3 lib/we_the_people/resources/petition.rb