population_growth 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91d468939397c0910090d078c7743e84a0a06442
4
- data.tar.gz: 477bad2711d515ae0c8e5330ada19b7a0ee59521
3
+ metadata.gz: d0dc897b307bfb82d8b66c32c9ae943331330b26
4
+ data.tar.gz: d8a43d289803b39e71ade12ec94796e31bd91d6d
5
5
  SHA512:
6
- metadata.gz: 006d69369e8fbc3a22390225b360f0587b963a78340e62bc332da1ade387b85946f8177d532198a35424a7050fdabc7cacd0a882ae83ad94dd5e90ee9fd27461
7
- data.tar.gz: 8c8800c662bc6679c3d2c250faa25e1de23b4ff728c0a7e9311b406b7b7b98d2721137664b65edf90262c3cf128911c8b30322c6a1bcc5fc2c21fe6af71b12ac
6
+ metadata.gz: ebeee41ce5fed506be4144609c446c54ef8e0dc3396349dbd08bfa60a545bcda497824b5406be7f810de2ffd72148d55e9f0c7c5003441bcf4ad7770863e25ad
7
+ data.tar.gz: c33da760a59e3eba989a060e2e6bc3a9f0f93af94999d0e176b14655c7987cb627dd222ee87979ccb77e37c0cf2cb04cb46ed244f7c6efd8070e19f22b6fff4a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- population_growth (0.1.0)
4
+ population_growth (0.1.1)
5
5
  faraday (~> 0.15.2)
6
6
  multi_json (~> 1.13.1)
7
7
  oj (~> 3.6.5)
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # PopulationGrowth
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/population_growth`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This is an api client for the Population Growth API
6
4
 
7
5
  ## Installation
8
6
 
7
+ I published this gem on RubyGems so the below instructions should work for pulling it down.
8
+
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
@@ -20,19 +20,39 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install population_growth
22
22
 
23
+ If neither of those options above work, you can just clone this repo and do a `bundle console` or build it locally in order to play with it.
24
+
23
25
  ## Usage
24
26
 
25
- TODO: Write usage instructions here
27
+ Every request will go through the `PopulationGrowth::Client` object. To start, instantiate it
28
+
29
+ `client = PopulationGrowth::Client.new` If we had access token requirements then we would pass them in here.
30
+
31
+ To get population data for a particular location
32
+
33
+ `location = client.locations.find(zip: 'your_zip_code_here')`
34
+
35
+ `location` will now have the following methods:
36
+
37
+ ```ruby
38
+ location.zip_code
39
+ location.cbsa
40
+ location.msa
41
+ location.pop_2015
42
+ location.pop_2014
43
+ location.data
44
+ ```
26
45
 
27
- ## Development
46
+ `location.data` provides a hash with all the attributes at once
28
47
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+ ## Discussion
30
49
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+ - `client.locations` returns an instance of `PopulationGrowth::LocationsConnection` which contains all the avaialable actions we can take for the locations resource (get, create, update, etc.)
51
+ - `client.locations.find(zip: 'some_zip')` returns an instance of `PopulationGrowth::Location`, which is basically just a wrapper for the api data that comes in.
32
52
 
33
- ## Contributing
53
+ - The attempt here was to have each client method be an instance of a resource connection. It made more sense to me to keep all knowledge about how to interact with a particular resource into the resource connection object.
54
+ - I've worked on a couple API clients before where the client acts as the central hub and each method represents an single endpoint. If you have dozens of resources, each with multiple endpoints, then it becomes too difficult to maintain the client object.
34
55
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/population_growth. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
56
 
37
57
  ## License
38
58
 
@@ -1,3 +1,3 @@
1
1
  module PopulationGrowth
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: population_growth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Phan