arcgis-opendata 0.0.6 → 0.0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/client.rb +4 -4
- 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: e7ce8ba7a55091fc17bce28e6d22fab327e7c390
|
4
|
+
data.tar.gz: 54ac2e9fdf640bb8625dc9de816b8f7c413d9041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6483cceec52a6c9a4e5516de800acfbe29d515b1c26d59b104ae52562e83b51f0652f144f884d4583e16bd6754a944ff20ca66aecbfff81077b7a80fe7b6ebb
|
7
|
+
data.tar.gz: 69d6b66e9b6332e8e23b59638b1cb860bbfeed02648e3a2be68425c813effbf251fee54e4996283194a59c41364a0f458ff4983e9343e0897e606e99e43e6d62
|
data/README.md
CHANGED
@@ -77,6 +77,22 @@ response = client.dataset_show('4df13_11', include: 'organizations,groups')
|
|
77
77
|
# => returns a Faraday::Response object
|
78
78
|
```
|
79
79
|
|
80
|
+
### Learn how the parameters turn into request urls
|
81
|
+
|
82
|
+
If you're curious about how urls are turned into API calls there are public methods that return the urls that would be created
|
83
|
+
based on the parameters you pass in. I'm a fan of not completely abstracting the underlying API, and I also like urls a lot so
|
84
|
+
we have these methods to allow developers to learn how urls are constructed.
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
client = Opendata.new('https://opendata.arcgis.com')
|
88
|
+
|
89
|
+
client.dataset_list_url(q: 'census', page: { size: 25 }, include: 'organizations,sites', sort: '-updated_at')
|
90
|
+
#=> '/api/v2/datasets?q=census&page%5Bsize%5D=25&include=organizations%2Csites&sort=-updated_at'
|
91
|
+
|
92
|
+
client.dataset_show_url('5353e1550e964d39b9bdde5ff391ab09_0', include: 'organizations')
|
93
|
+
#=> '/api/v2/datasets/5353e1550e964d39b9bdde5ff391ab09_0?include=organizations'
|
94
|
+
```
|
95
|
+
|
80
96
|
## Development
|
81
97
|
|
82
98
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. ~~You can also run `bin/console` for an interactive prompt that will allow you to experiment.~~ `bin/console` is currently not working
|
data/lib/client.rb
CHANGED
@@ -19,13 +19,13 @@ module Opendata
|
|
19
19
|
# @param params [Hash] query parameters for Dataset resources
|
20
20
|
# @return [Object] Faraday::Response object
|
21
21
|
def dataset_list(params = {})
|
22
|
-
connection.get(
|
22
|
+
connection.get(dataset_list_url(params))
|
23
23
|
end
|
24
24
|
|
25
25
|
# Makes requests for 'logical collections' of Dataset resources (zero-to-many potential dataset resources)
|
26
26
|
# @param params [Hash] query parameters for Dataset resources
|
27
27
|
# @return [String] request url based on the parameters specfied
|
28
|
-
def
|
28
|
+
def dataset_list_url(params = {})
|
29
29
|
DATASETS_API_PATH + param_to_query_string(params)
|
30
30
|
end
|
31
31
|
|
@@ -46,6 +46,8 @@ module Opendata
|
|
46
46
|
DATASETS_API_PATH + "/#{id}" + param_to_query_string(params)
|
47
47
|
end
|
48
48
|
|
49
|
+
private
|
50
|
+
|
49
51
|
def param_to_query_string(params)
|
50
52
|
adjusted_params = {}
|
51
53
|
|
@@ -65,8 +67,6 @@ module Opendata
|
|
65
67
|
|
66
68
|
query_string == "" ? query_string : "?#{query_string}"
|
67
69
|
end
|
68
|
-
|
69
|
-
private
|
70
70
|
|
71
71
|
attr_reader :connection
|
72
72
|
|
data/lib/version.rb
CHANGED