Class: WeThePeople::Config
- Inherits:
-
Object
- Object
- WeThePeople::Config
show all
- Defined in:
- lib/we_the_people/config.rb
Defined Under Namespace
Classes: MotionHTTPWrapper, MotionJSONWrapper
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
60
61
62
|
# File 'lib/we_the_people/config.rb', line 60
def api_key
@api_key
end
|
.client ⇒ Object
44
45
46
|
# File 'lib/we_the_people/config.rb', line 44
def client
@client ||= (in_motion? ? MotionHTTPWrapper : RestClient)
end
|
.default_page_size ⇒ Object
39
40
41
|
# File 'lib/we_the_people/config.rb', line 39
def default_page_size
@default_page_size ||= 1000
end
|
.mock ⇒ Object
Returns the value of attribute mock.
69
70
71
|
# File 'lib/we_the_people/config.rb', line 69
def mock
@mock
end
|
Class Method Details
.default_params ⇒ Object
62
63
64
65
66
67
|
# File 'lib/we_the_people/config.rb', line 62
def default_params
params = { :key => @api_key }
params.merge!(:mock => 1) if @mock
params.merge!(:limit => default_page_size)
params
end
|
.host ⇒ Object
56
57
58
|
# File 'lib/we_the_people/config.rb', line 56
def host
"http://api.whitehouse.gov/v1"
end
|
.in_motion? ⇒ Boolean
52
53
54
|
# File 'lib/we_the_people/config.rb', line 52
def in_motion?
defined?(BW)
end
|
.json ⇒ Object
48
49
50
|
# File 'lib/we_the_people/config.rb', line 48
def json
in_motion? ? MotionJSONWrapper : JSON
end
|