we_the_people 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,13 +4,7 @@
4
4
 
5
5
  # Quickstart
6
6
 
7
- First, you'll need to configure your API key:
8
-
9
- ```ruby
10
- WeThePeople::Config.api_key = "1234abcd"
11
- ```
12
-
13
- Now you're ready to start asking for resources. Here are a few example calls:
7
+ Here are a few example calls:
14
8
 
15
9
  ```ruby
16
10
  >> petition = WeThePeople::Resources::Petition.find("1234")
@@ -32,7 +26,7 @@ Now you're ready to start asking for resources. Here are a few example calls:
32
26
 
33
27
  You can configure a few options on the `WeThePeople` module:
34
28
 
35
- * `api_key` - Required to make any calls; your We The People API key.
29
+ * `api_key` - Your We The People API key (optional).
36
30
  * `default_page_size` - The page size to request by default for all resources.
37
31
  * `client` - If you don't want to use `rest-client` you can substitute in another HTTP client object that conforms to the same API here.
38
32
  * `mock` - If set to "1", all requests will return mock results.
@@ -69,17 +69,18 @@ module WeThePeople
69
69
  COERCERS[klass].call(val)
70
70
  end
71
71
 
72
- def attribute(name, coerce_to = nil)
72
+ def attribute(name, coerce_to = nil, key_name = nil)
73
73
  name = name.to_s
74
- add_attribute_key(name)
74
+ key_name ||= name
75
+ add_attribute_key(key_name)
75
76
 
76
77
  define_method "#{name}=" do |val|
77
78
  val = self.class.coerce_value(val, coerce_to) if coerce_to
78
- @attributes[name] = val
79
+ @attributes[key_name] = val
79
80
  end
80
81
 
81
82
  define_method name do
82
- coerce_to ? self.class.coerce_value(@attributes[name], coerce_to) : @attributes[name]
83
+ coerce_to ? self.class.coerce_value(@attributes[key_name], coerce_to) : @attributes[key_name]
83
84
  end
84
85
  end
85
86
 
@@ -6,9 +6,9 @@ module WeThePeople
6
6
  attribute :title
7
7
  attribute :body
8
8
  attribute :status
9
- attribute :signature_threshold, Integer
10
- attribute :signature_count, Integer
11
- attribute :signatures_needed, Integer
9
+ attribute :signature_threshold, Integer, 'signatureThreshold'
10
+ attribute :signature_count, Integer, 'signatureCount'
11
+ attribute :signatures_needed, Integer, 'signaturesNeeded'
12
12
  attribute :deadline, Time
13
13
  attribute :created, Time
14
14
 
data/lib/we_the_people.rb CHANGED
@@ -39,5 +39,5 @@ if defined?(Motion::Project::Config)
39
39
  end
40
40
 
41
41
  module WeThePeople
42
- VERSION = '0.0.3'
42
+ VERSION = '0.0.4'
43
43
  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.3'
17
- s.date = '2013-04-25'
16
+ s.version = '0.0.4'
17
+ s.date = '2013-05-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.3
4
+ version: 0.0.4
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-04-25 00:00:00.000000000 Z
12
+ date: 2013-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client