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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -0
  3. data/lib/client.rb +4 -4
  4. data/lib/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45bd9d987a78c6dd42d3990c6dd2f23976afb633
4
- data.tar.gz: 8a70222a96289c8832b1f6e97720e014066ffeb6
3
+ metadata.gz: e7ce8ba7a55091fc17bce28e6d22fab327e7c390
4
+ data.tar.gz: 54ac2e9fdf640bb8625dc9de816b8f7c413d9041
5
5
  SHA512:
6
- metadata.gz: 9c9666b49c7acd7dc8421fd0d10b9aebd280ea9e3c5e6a0fc3a4bd0dce5cd48e43829ef8d168edb07b3fb49e471004762dc14c137c6b62d97d82c8567d1559f1
7
- data.tar.gz: 64b8053ab24c769b06fae0376b0bd851c40f39bac1ca39710cd30ee70ded33058b9f9a8bce6ebef32c0652f913d1bd2b13d7ba3c7f8a9851364a4de56a36549a
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(dataset_list_request(params))
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 dataset_list_request(params = {})
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
@@ -1,3 +1,3 @@
1
1
  module Opendata
2
- VERSION = '0.0.6'.freeze
2
+ VERSION = '0.0.6.1'.freeze
3
3
  end
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.6
4
+ version: 0.0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Harris