we_the_people 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +2 -8
- data/lib/we_the_people/resource.rb +5 -4
- data/lib/we_the_people/resources/petition.rb +3 -3
- data/lib/we_the_people.rb +1 -1
- data/we_the_people.gemspec +2 -2
- metadata +2 -2
data/README.md
CHANGED
@@ -4,13 +4,7 @@
|
|
4
4
|
|
5
5
|
# Quickstart
|
6
6
|
|
7
|
-
|
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` -
|
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
|
-
|
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[
|
79
|
+
@attributes[key_name] = val
|
79
80
|
end
|
80
81
|
|
81
82
|
define_method name do
|
82
|
-
coerce_to ? self.class.coerce_value(@attributes[
|
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
data/we_the_people.gemspec
CHANGED
@@ -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.
|
17
|
-
s.date = '2013-
|
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.
|
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-
|
12
|
+
date: 2013-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|