Class: BlueStateDigital::DatasetMaps
- Inherits:
-
CollectionResource
- Object
- CollectionResource
- BlueStateDigital::DatasetMaps
- Defined in:
- lib/blue_state_digital/dataset_map.rb
Constant Summary collapse
- FETCH_ENDPOINT =
'/cons/list_dataset_maps'
Instance Attribute Summary
Attributes inherited from CollectionResource
Instance Method Summary collapse
Methods inherited from CollectionResource
Constructor Details
This class inherits a constructor from BlueStateDigital::CollectionResource
Instance Method Details
#get_dataset_maps ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/blue_state_digital/dataset_map.rb', line 115 def get_dataset_maps if connection response = connection.perform_request FETCH_ENDPOINT, { api_ver: 2 }, "GET" # TODO: Should check response's status code begin parsed_response = JSON.parse(response) data = parsed_response['data'] if(data) data.map do |dataset| DatasetMap.new(dataset) end else nil end rescue StandardError => e raise FetchFailureException.new("#{e}") end else raise NoConnectionException.new end end |