we_the_people 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -52,14 +52,6 @@ Rake::TestTask.new(:test) do |test|
52
52
  test.verbose = true
53
53
  end
54
54
 
55
- desc "Generate RCov test coverage and open in your browser"
56
- task :coverage do
57
- require 'rcov'
58
- sh "rm -fr coverage"
59
- sh "rcov test/test_*.rb"
60
- sh "open coverage/index.html"
61
- end
62
-
63
55
  require 'rdoc/task'
64
56
  Rake::RDocTask.new do |rdoc|
65
57
  rdoc.rdoc_dir = 'rdoc'
@@ -39,5 +39,5 @@ if defined?(Motion::Project::Config)
39
39
  end
40
40
 
41
41
  module WeThePeople
42
- VERSION = '0.0.5'
42
+ VERSION = '0.0.6'
43
43
  end
@@ -1,4 +1,4 @@
1
- class Struct
1
+ class EmbeddedResourceObject < Struct
2
2
  def self.hash_initialized(*keys)
3
3
  klass = Class.new(self.new(*keys))
4
4
  keys = keys.map(&:to_s)
@@ -11,8 +11,12 @@ class Struct
11
11
 
12
12
  klass
13
13
  end
14
+
15
+ def to_json(_)
16
+ Hash[self.each_pair.to_a].to_json
17
+ end
14
18
  end
15
19
 
16
20
  def EmbeddedResource(*keys)
17
- Struct.hash_initialized(*keys)
21
+ EmbeddedResourceObject.hash_initialized(*keys)
18
22
  end
@@ -161,5 +161,9 @@ module WeThePeople
161
161
  def path
162
162
  "#{self.class.path}/#{id}"
163
163
  end
164
+
165
+ def to_json
166
+ @attributes.to_json
167
+ end
164
168
  end
165
169
  end
@@ -6,6 +6,7 @@ module WeThePeople
6
6
  attribute :title
7
7
  attribute :body
8
8
  attribute :status
9
+ attribute :url
9
10
  attribute :signature_threshold, Integer, 'signatureThreshold'
10
11
  attribute :signature_count, Integer, 'signatureCount'
11
12
  attribute :signatures_needed, Integer, 'signaturesNeeded'
@@ -22,7 +23,19 @@ module WeThePeople
22
23
  end
23
24
 
24
25
  def failed?
25
- deadline < Time.now && !successful?
26
+ expired? && !successful?
27
+ end
28
+
29
+ def signatures_needed?
30
+ signatures_needed > 0
31
+ end
32
+
33
+ def response?
34
+ !response.nil?
35
+ end
36
+
37
+ def expired?
38
+ deadline < Time.now
26
39
  end
27
40
  end
28
41
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'we_the_people'
16
- s.version = '0.0.5'
17
- s.date = '2013-05-31'
16
+ s.version = '0.0.6'
17
+ s.date = '2013-06-01'
18
18
  s.rubyforge_project = 'we_the_people'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: we_the_people
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-31 00:00:00.000000000 Z
12
+ date: 2013-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client