pyr 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pyr/resources/reps.rb +120 -0
- data/lib/pyr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c927358cc195c550b23e1ec8ff2acf3c0e53c6e
|
4
|
+
data.tar.gz: 38a39b3a5a401a2d08bf6bd1276b4403f0664579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 481552f67f2f856b9772bc4ba1587eb401638e359e2156d738f60fdc7f974d6999e5f0f53d6ec192f27861c3432bbaa2a2fd88c936e481b2cb752bbf90f11618
|
7
|
+
data.tar.gz: cbe89a672721ad2c7e3bebb99018bffd07a929320de648147292d01aba2dfdd8bda273dbfe42239e351aa5863eb465c02da145e19a174719534d58d4855779a0
|
data/lib/pyr/resources/reps.rb
CHANGED
@@ -5,6 +5,126 @@ module PYR
|
|
5
5
|
# Resource object for sending requests to the /reps resource of the API
|
6
6
|
class Reps < Resource
|
7
7
|
include GeoFindable
|
8
|
+
|
9
|
+
# Read the state param
|
10
|
+
attr_reader :state
|
11
|
+
|
12
|
+
# Read the district param
|
13
|
+
attr_reader :district
|
14
|
+
|
15
|
+
# Read the party param
|
16
|
+
attr_reader :party
|
17
|
+
|
18
|
+
# Read the chamber param
|
19
|
+
attr_reader :chamber
|
20
|
+
|
21
|
+
# Set the state param. Can be the full name or two-letter abbreviation.
|
22
|
+
#
|
23
|
+
# @param name [String]
|
24
|
+
#
|
25
|
+
# @api public
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# PYR.call :reps do |r|
|
29
|
+
# r.state = 'texas'
|
30
|
+
# end
|
31
|
+
# Resulting URI
|
32
|
+
# 'https://phone-your-rep.herokuapp.com/api/beta/reps?lat=45.0&long=-45.0'
|
33
|
+
def state=(name)
|
34
|
+
@state = Param.new(:state, name)
|
35
|
+
params << @state
|
36
|
+
end
|
37
|
+
|
38
|
+
# Set the district param. Accepts the two-digit district code or
|
39
|
+
# four-digit full code.
|
40
|
+
#
|
41
|
+
# @param code [String]
|
42
|
+
#
|
43
|
+
# @api public
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# PYR.call :reps do |r|
|
47
|
+
# r.district = '5000'
|
48
|
+
# end
|
49
|
+
def district=(code)
|
50
|
+
@district = Param.new(:district, code)
|
51
|
+
params << @district
|
52
|
+
end
|
53
|
+
|
54
|
+
# Set the party param
|
55
|
+
#
|
56
|
+
# @param name [String]
|
57
|
+
#
|
58
|
+
# @api public
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# PYR.call :reps do |r|
|
62
|
+
# r.party = 'democrat'
|
63
|
+
# end
|
64
|
+
def party=(name)
|
65
|
+
@party = Param.new(:party, name)
|
66
|
+
params << @party
|
67
|
+
end
|
68
|
+
|
69
|
+
# Set the chamber param
|
70
|
+
#
|
71
|
+
# @param chamber [String]
|
72
|
+
#
|
73
|
+
# @api public
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
# PYR.call :reps do |r|
|
77
|
+
# r.chamber = 'lower'
|
78
|
+
# end
|
79
|
+
def chamber=(chamber)
|
80
|
+
@chamber = Param.new(:chamber, chamber)
|
81
|
+
params << @chamber
|
82
|
+
end
|
83
|
+
|
84
|
+
# Set the independent boolean param
|
85
|
+
#
|
86
|
+
# @param boolean [Boolean]
|
87
|
+
#
|
88
|
+
# @api public
|
89
|
+
#
|
90
|
+
# @example
|
91
|
+
# PYR.call :reps do |r|
|
92
|
+
# r.independent = true
|
93
|
+
# end
|
94
|
+
def independent=(boolean)
|
95
|
+
@independent = Param.new(:independent, boolean)
|
96
|
+
params << @independent
|
97
|
+
end
|
98
|
+
|
99
|
+
# Set the republican boolean param
|
100
|
+
#
|
101
|
+
# @param boolean [Boolean]
|
102
|
+
#
|
103
|
+
# @api public
|
104
|
+
#
|
105
|
+
# @example
|
106
|
+
# PYR.call :reps do |r|
|
107
|
+
# r.republican = true
|
108
|
+
# end
|
109
|
+
def republican=(boolean)
|
110
|
+
@republican = Param.new(:republican, boolean)
|
111
|
+
params << @republican
|
112
|
+
end
|
113
|
+
|
114
|
+
# Set the democrat boolean param
|
115
|
+
#
|
116
|
+
# @param boolean [Boolean]
|
117
|
+
#
|
118
|
+
# @api public
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
# PYR.call :reps do |r|
|
122
|
+
# r.democrat = true
|
123
|
+
# end
|
124
|
+
def democrat=(boolean)
|
125
|
+
@democrat = Param.new(:democrat, boolean)
|
126
|
+
params << @democrat
|
127
|
+
end
|
8
128
|
end
|
9
129
|
end
|
10
130
|
end
|
data/lib/pyr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pyr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- M. Simon Borg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|