Class: Facilities::DrivetimeBands::Client
- Inherits:
-
Common::Client::Base
- Object
- Common::Client::Base
- Facilities::DrivetimeBands::Client
- Defined in:
- lib/facilities/drivetime_bands/client.rb
Overview
Core class responsible for api interface operations
Instance Method Summary collapse
Methods inherited from Common::Client::Base
configuration, #raise_backend_exception
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger
Instance Method Details
#build_params(offset, limit) ⇒ Object
30 31 32 33 34 |
# File 'lib/facilities/drivetime_bands/client.rb', line 30 def build_params(offset, limit) { where: '1=1', inSR: 4326, outSR: 4326, returnGeometry: true, returnCountOnly: false, outFields: '*', returnDistinctValues: false, orderByFields: 'Name', f: 'json', resultOffset: offset, resultRecordCount: limit } end |
#get_drivetime_bands(offset, limit) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/facilities/drivetime_bands/client.rb', line 16 def get_drivetime_bands(offset, limit) params = build_params(offset, limit) response = perform(:get, '/arcgis2/rest/services/Portal/MonthlyVAST_TTB/FeatureServer/0/query', params) drivetime_band_response = Facilities::DrivetimeBands::Response.new(response.body) if drivetime_band_response.parsed_json.key?('error') raise Facilities::DrivetimeBands::DownloadError, "Error in request at offset #{offset} and limit #{limit}. Cause: #{drivetime_band_response.parsed_json['error']}" end drivetime_band_response.get_features end |