Class: WeThePeople::Resources::Petition

Inherits:
WeThePeople::Resource show all
Defined in:
lib/we_the_people/resources/petition.rb

Constant Summary

Constants inherited from WeThePeople::Resource

WeThePeople::Resource::COERCERS

Instance Method Summary collapse

Methods inherited from WeThePeople::Resource

add_attribute_key, all, attribute, bare_name, belongs_to, build_index_url, build_resource_url, coerce_value, cursor, fetch, find, has_embedded, has_many, has_many_embedded, #initialize, path, #path, #to_json

Constructor Details

This class inherits a constructor from WeThePeople::Resource

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/we_the_people/resources/petition.rb', line 37

def expired?
  deadline < Time.now
end

#failed?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/we_the_people/resources/petition.rb', line 25

def failed?
  expired? && !successful?
end

#response?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/we_the_people/resources/petition.rb', line 33

def response?
  !response.nil?
end

#signatures_needed?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/we_the_people/resources/petition.rb', line 29

def signatures_needed?
  signatures_needed > 0
end

#successful?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/we_the_people/resources/petition.rb', line 21

def successful?
  signatures_needed == 0
end