Class: WeThePeople::Config

Inherits:
Object
  • Object
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_keyObject

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

.clientObject



44
45
46
# File 'lib/we_the_people/config.rb', line 44

def client
  @client ||= (in_motion? ? MotionHTTPWrapper : RestClient)
end

.default_page_sizeObject



39
40
41
# File 'lib/we_the_people/config.rb', line 39

def default_page_size
  @default_page_size ||= 1000
end

.mockObject

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_paramsObject



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

.hostObject



56
57
58
# File 'lib/we_the_people/config.rb', line 56

def host
  "http://api.whitehouse.gov/v1"
end

.in_motion?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/we_the_people/config.rb', line 52

def in_motion?
  defined?(BW)
end

.jsonObject



48
49
50
# File 'lib/we_the_people/config.rb', line 48

def json
  in_motion? ? MotionJSONWrapper : JSON
end