arcgis-opendata 0.0.6.1 → 0.0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/client.rb +31 -1
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eefd21b860fbf351964f16b82afaeb82218a9bd4
|
4
|
+
data.tar.gz: 4b4ac871e146aee342dede7d3535692744a62741
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89a93d2a533f92bf00b9b0a922bc9bd9ef6958d6f8585aaa98bfbdb29236ca5daddaa804ff49af149d8711c5452138262c4288a20145dc9b1ed849df7d4fbe6b
|
7
|
+
data.tar.gz: 6e40a3bfca72a94794af5cc3c3ca3469d01378b26224715b29b30a02445d6b6eec4d76787bf1d65b9313be79be733236eb892c522d6a5002b5602e3074852349
|
data/lib/client.rb
CHANGED
@@ -16,7 +16,20 @@ module Opendata
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Makes requests for 'logical collections' of Dataset resources (zero-to-many potential dataset resources)
|
19
|
-
# @param
|
19
|
+
# @param [Hash] params query parameters for Dataset resources
|
20
|
+
# @option params [String] :q The query string for searching against datasets
|
21
|
+
# @option params [String] :include Comma-separate list of related resources to include. valid options are: 'organizations', 'groups', 'sites', 'items'
|
22
|
+
# @option params [String] :sort Sort criteria for the request. prepend a '-' to make the sort descending.
|
23
|
+
# @option params [Hash] :page Paging on the request. use { page: {size: Integer}} for page size and { page: { number: Integer}} for the page number
|
24
|
+
# @option params [Hash] :fields The attribute subset you want returned for each object. Use like {fields: { datasets: 'title,url'}}
|
25
|
+
#
|
26
|
+
# @example Search for census datasets, 25 per page and include their related organizations and sites
|
27
|
+
# client = Opendata.new('https://opendata.arcgis.com')
|
28
|
+
# client.dataset_list(q: 'census', page: { size: 25 }, include: 'organizations,sites')
|
29
|
+
# @example Search for parcel datasets, second page, and include their related organizations and filter the dataset fields to title and url
|
30
|
+
# client = Opendata.new('https://opendata.arcgis.com')
|
31
|
+
# client.dataset_list(q: 'parcels', page: { number: 2 }, include: 'organizations', fields: { datasets: 'title,url'})
|
32
|
+
#
|
20
33
|
# @return [Object] Faraday::Response object
|
21
34
|
def dataset_list(params = {})
|
22
35
|
connection.get(dataset_list_url(params))
|
@@ -24,6 +37,11 @@ module Opendata
|
|
24
37
|
|
25
38
|
# Makes requests for 'logical collections' of Dataset resources (zero-to-many potential dataset resources)
|
26
39
|
# @param params [Hash] query parameters for Dataset resources
|
40
|
+
# @example Get the request url for a search for census datasets, 25 per page and include their related organizations and sites
|
41
|
+
# client = Opendata.new('https://opendata.arcgis.com')
|
42
|
+
# client.dataset_list_url(q: 'census', page: { size: 25 }, include: 'organizations,sites')
|
43
|
+
# #=> "/api/v2/datasets?q=census&page%5Bsize%5D=25&include=organizations%2Csites"
|
44
|
+
#
|
27
45
|
# @return [String] request url based on the parameters specfied
|
28
46
|
def dataset_list_url(params = {})
|
29
47
|
DATASETS_API_PATH + param_to_query_string(params)
|
@@ -32,6 +50,14 @@ module Opendata
|
|
32
50
|
# Makes requests for a 'logical object' for a specific Dataset resource (zero-to-one potential dataset resources)
|
33
51
|
# @param id [String] The dataset id
|
34
52
|
# @param params [Hash] Additional request parameters
|
53
|
+
#
|
54
|
+
# @example Retrive a dataset and related organizations and sites
|
55
|
+
# client = Opendata.new('https://opendata.arcgis.com')
|
56
|
+
# client.dataset_show('c92b122901ad40ee897d36b1a21f3187_11', include: 'organizations,sites')
|
57
|
+
#
|
58
|
+
# @example Retrive a dataset and specify a subset of fields (title,url,description,thumbnail)
|
59
|
+
# client = Opendata.new('https://opendata.arcgis.com')
|
60
|
+
# client.dataset_show('c92b122901ad40ee897d36b1a21f3187_11', fields: { datasets: 'title,url,description,thumbnail'})
|
35
61
|
# @return [Object] Faraday::Response object
|
36
62
|
def dataset_show(id, params = {})
|
37
63
|
raise '#dataset_show must receive a dataset id' if id.nil?
|
@@ -41,6 +67,10 @@ module Opendata
|
|
41
67
|
# Returns the url based on the id and url parameters specified
|
42
68
|
# @param id [String] The dataset id
|
43
69
|
# @param params [Hash] Additional request parameters
|
70
|
+
# @example Get the requets url for retrieving a single dataset and its related organizations and sites
|
71
|
+
# client = Opendata.new('https://opendata.arcgis.com')
|
72
|
+
# client.dataset_show_url('c92b122901ad40ee897d36b1a21f3187_11', include: 'organizations,sites')
|
73
|
+
# #=> "/api/v2/datasets/c92b122901ad40ee897d36b1a21f3187_11?include=organizations%2Csites"
|
44
74
|
# @return [String] request url based on id and parameters specified
|
45
75
|
def dataset_show_url(id, params = {})
|
46
76
|
DATASETS_API_PATH + "/#{id}" + param_to_query_string(params)
|
data/lib/version.rb
CHANGED