arcgis-opendata 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c065d52e32cc272d56f7a04f117ab89cce21ac7
4
- data.tar.gz: 95037aa5f76d2c87448ac6d7da9915a0074daf33
3
+ metadata.gz: 45bd9d987a78c6dd42d3990c6dd2f23976afb633
4
+ data.tar.gz: 8a70222a96289c8832b1f6e97720e014066ffeb6
5
5
  SHA512:
6
- metadata.gz: 6006728d0c3a4675070a17d74c076c303336f7c1b21e3f590bfcecb35914b08669d5e7caccee2989bccfcd59b1e213c551abb3a383efaa37a3fd84cecb933eed
7
- data.tar.gz: 0c4404deaa18ad1fbb28b5b7488bec89d16bff5c55d3e255eeba34480d8b98bfe076532ce945daf1a79289c059abf44d86265ccafd8ddc1bc66826ffe22c419e
6
+ metadata.gz: 9c9666b49c7acd7dc8421fd0d10b9aebd280ea9e3c5e6a0fc3a4bd0dce5cd48e43829ef8d168edb07b3fb49e471004762dc14c137c6b62d97d82c8567d1559f1
7
+ data.tar.gz: 64b8053ab24c769b06fae0376b0bd851c40f39bac1ca39710cd30ee70ded33058b9f9a8bce6ebef32c0652f913d1bd2b13d7ba3c7f8a9851364a4de56a36549a
data/README.md CHANGED
@@ -37,6 +37,30 @@ You can also instantiate an instance directly from the Opendata module
37
37
  client = Opendata.new('https://opendata.arcgis.com')
38
38
  ```
39
39
 
40
+ ### Example Dataset Queries
41
+
42
+ Search Parameters are JSONAPI compliant. To learn more about the JSONAPI parameters go to their section
43
+ about [fetching data](http://jsonapi.org/format/#fetching) at jsonapi.org
44
+
45
+ Parameters supported for `dataset_list`
46
+
47
+ | Parameter | Type | Description | Usage |
48
+ | --------- | ---- | ----------- | ----- |
49
+ | q | String | query to perform against the datasets resource | `client#dataset_list(q: 'census')` |
50
+ | sort | String | specifies sort criteria. prepend with a '-' to signify a descending sort| `client#dataset_list(sort: '-updated_at')` |
51
+ | include | String | comma-separate list of resources to 'side-load' | `client#dataset_list(include: 'organizations,sites')` |
52
+ | fields | nested | allows the client to specify a subset of attributes to be returned by the API | `client#dataset_list(fields: { datasets: 'title,url'})` |
53
+ | filter | nested | filter the datasets on filterable attributes | `client#dataset_list(filter: { content: 'spatial dataset'})` |
54
+ | page | nested | specify paging parameters. | `client#dataset_list(page: { size: 25, number: 2})`
55
+
56
+ Parameters supported for `dataset_show`
57
+
58
+ | Parameter | Type | Description | Usage |
59
+ | --------- | ---- | ----------- | ----- |
60
+ | include | String | comma-separate list of resources to 'side-load' | `client#dataset_list(include: 'organizations,sites')` |
61
+ | fields | nested | allows the client to specify a subset of attributes to be returned by the API | `client#dataset_list(fields: { datasets: 'title,url'})` |
62
+
63
+
40
64
  Make queries for datasets
41
65
  ```ruby
42
66
  client = Opendata.new('https://opendata.arcgis.com')
data/lib/client.rb CHANGED
@@ -1,10 +1,9 @@
1
+ require 'version'
1
2
  require 'faraday'
2
3
  require 'uri'
3
4
 
4
5
  module Opendata
5
6
 
6
- VERSION = '0.0.5'.freeze
7
-
8
7
  class Client
9
8
 
10
9
  # Constructor for Opendata::Client instances
@@ -20,16 +19,31 @@ module Opendata
20
19
  # @param params [Hash] query parameters for Dataset resources
21
20
  # @return [Object] Faraday::Response object
22
21
  def dataset_list(params = {})
23
- connection.get(DATASETS_API_PATH + param_to_query_string(params))
22
+ connection.get(dataset_list_request(params))
23
+ end
24
+
25
+ # Makes requests for 'logical collections' of Dataset resources (zero-to-many potential dataset resources)
26
+ # @param params [Hash] query parameters for Dataset resources
27
+ # @return [String] request url based on the parameters specfied
28
+ def dataset_list_request(params = {})
29
+ DATASETS_API_PATH + param_to_query_string(params)
24
30
  end
25
31
 
26
32
  # Makes requests for a 'logical object' for a specific Dataset resource (zero-to-one potential dataset resources)
27
33
  # @param id [String] The dataset id
28
34
  # @param params [Hash] Additional request parameters
35
+ # @return [Object] Faraday::Response object
29
36
  def dataset_show(id, params = {})
30
37
  raise '#dataset_show must receive a dataset id' if id.nil?
38
+ connection.get(dataset_show_url(id, params))
39
+ end
31
40
 
32
- connection.get(DATASETS_API_PATH + "/#{id}" + param_to_query_string(params))
41
+ # Returns the url based on the id and url parameters specified
42
+ # @param id [String] The dataset id
43
+ # @param params [Hash] Additional request parameters
44
+ # @return [String] request url based on id and parameters specified
45
+ def dataset_show_url(id, params = {})
46
+ DATASETS_API_PATH + "/#{id}" + param_to_query_string(params)
33
47
  end
34
48
 
35
49
  def param_to_query_string(params)
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Opendata
2
+ VERSION = '0.0.6'.freeze
3
+ end
data/opendata.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'opendata'
4
+ require 'version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "arcgis-opendata"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arcgis-opendata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Harris
@@ -97,6 +97,7 @@ files:
97
97
  - bin/setup
98
98
  - lib/client.rb
99
99
  - lib/opendata.rb
100
+ - lib/version.rb
100
101
  - opendata.gemspec
101
102
  homepage: https://github.com/esridc/arcgis-opendata.rb
102
103
  licenses: