chicago_business_licenses 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/chicago_business_licenses.gemspec +34 -0
- data/lib/chicago_business_licenses.rb +83 -0
- data/lib/chicago_business_licenses/version.rb +3 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57df20fda4d0010efd7155e3bd03d44f8bcd8ac2
|
4
|
+
data.tar.gz: 2ade9a2ab0bacd5e7497e6890e910720d315e76a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f3e523f8c9c21bd6110fb0dde8d1c8ba324816fa91022abf70257ffd14ad50cb3c7440269e9697a086ea056c57c7937861982a45991329edb480d4ac045b75b4
|
7
|
+
data.tar.gz: 7843ed70d2e2d3825cfe79b15e118d6b1cb36cc2ba2d50343a58fd25806648977d0f8d38f0e593bd45007271c104d13c77b5bf6ed8c57a8ffe0ba3a3baca87bf
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 nealdeters
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# ChicagoBusinessLicenses
|
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/chicago_business_licenses`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
Allows you to access City of Chicago's Business Licenses public API from ruby.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'chicago_business_licenses'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install chicago_business_licenses
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
To get all of the City of Chicago Business Licenses, run this code:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
licenses = ChicagoBusinessLicenses::License.all
|
29
|
+
```
|
30
|
+
|
31
|
+
To get all of the City of Chicago Employees with a search keyword, run this code:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
licenses = ChicagoBusinessLicenses::License.search('renew')
|
35
|
+
```
|
36
|
+
|
37
|
+
Replace 'renew' with your own search keyword.
|
38
|
+
|
39
|
+
## Development
|
40
|
+
|
41
|
+
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.
|
42
|
+
|
43
|
+
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).
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/chicago_business_licenses.
|
48
|
+
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
53
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "chicago_business_licenses"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'chicago_business_licenses/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "chicago_business_licenses"
|
8
|
+
spec.version = ChicagoBusinessLicenses::VERSION
|
9
|
+
spec.authors = ["nealdeters"]
|
10
|
+
spec.email = ["nealdeters@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Wrapper for the City of Chicago Business Licenses public API}
|
13
|
+
spec.description = %q{Allows you to access City of Chicago's Business Licenses public API from ruby.}
|
14
|
+
spec.homepage = "https://github.com/nealdeters/chicago_business_licenses"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
spec.add_dependency 'unirest', "~> 1.1.2"
|
34
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require "chicago_business_licenses/version"
|
2
|
+
require 'unirest'
|
3
|
+
|
4
|
+
module ChicagoBusinessLicenses
|
5
|
+
class License
|
6
|
+
attr_reader :account_number, :address, :application_created_date, :application_requirements_complete, :application_type, :city, :conditional_approval, :date_issued, :doing_business_as_name, :expiration_date, :id, :latitude, :legal_name, :license_approved_for_issuance, :license_code, :license_description, :license_id, :license_number, :license_start_date, :license_status, :license_status_change_date, :location, :longitude, :payment_date, :police_district, :precinct, :site_number, :state, :ward, :zip_code
|
7
|
+
|
8
|
+
def initialize(license_api_info)
|
9
|
+
@account_number = license_api_info["account_number"] ,
|
10
|
+
@address = license_api_info["address"] ,
|
11
|
+
@application_created_date = license_api_info["application_created_date"] ,
|
12
|
+
@application_requirements_complete = license_api_info["application_requirements_complete"] ,
|
13
|
+
@application_type = license_api_info["application_type"] ,
|
14
|
+
@city = license_api_info["city"] ,
|
15
|
+
@conditional_approval = license_api_info["conditional_approval"] ,
|
16
|
+
@date_issued = license_api_info["date_issued"] ,
|
17
|
+
@doing_business_as_name = license_api_info["doing_business_as_name"] ,
|
18
|
+
@expiration_date = license_api_info["expiration_date"] ,
|
19
|
+
@id = license_api_info["id"] ,
|
20
|
+
@latitude = license_api_info["latitude"] ,
|
21
|
+
@legal_name = license_api_info["legal_name"] ,
|
22
|
+
@license_approved_for_issuance = license_api_info["license_approved_for_issuance"] ,
|
23
|
+
@license_code = license_api_info["license_code"] ,
|
24
|
+
@license_description = license_api_info["license_description"] ,
|
25
|
+
@license_id = license_api_info["license_id"] ,
|
26
|
+
@license_number = license_api_info["license_number"] ,
|
27
|
+
@license_start_date = license_api_info["license_start_date"] ,
|
28
|
+
@license_status = license_api_info["license_status"] ,
|
29
|
+
@license_status_change_date = license_api_info["license_status_change_date"] ,
|
30
|
+
@location = license_api_info["location"],
|
31
|
+
@longitude = license_api_info["longitude"] ,
|
32
|
+
@payment_date = license_api_info["payment_date"] ,
|
33
|
+
@police_district = license_api_info["police_district"] ,
|
34
|
+
@precinct = license_api_info["precinct"] ,
|
35
|
+
@site_number = license_api_info["site_number"] ,
|
36
|
+
@state = license_api_info["state"] ,
|
37
|
+
@ward = license_api_info["ward"] ,
|
38
|
+
@zip_code = license_api_info["zip_code"]
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.all
|
42
|
+
api_array = Unirest.get("https://data.cityofchicago.org/resource/xqx5-8hwx.json").body
|
43
|
+
|
44
|
+
create_licenses(api_array)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.search(search_keyword)
|
48
|
+
api_array = Unirest.get("https://data.cityofchicago.org/resource/xqx5-8hwx.json?$q=#{search_keyword}").body
|
49
|
+
|
50
|
+
create_licenses(api_array)
|
51
|
+
end
|
52
|
+
|
53
|
+
# def self.first
|
54
|
+
# api_array = Unirest.get("https://data.cityofchicago.org/resource/xqx5-8hwx.json").body
|
55
|
+
|
56
|
+
# api_array.first
|
57
|
+
# end
|
58
|
+
|
59
|
+
# def self.last
|
60
|
+
# api_array = Unirest.get("https://data.cityofchicago.org/resource/xqx5-8hwx.json").body
|
61
|
+
|
62
|
+
# api_array.last
|
63
|
+
# end
|
64
|
+
|
65
|
+
# def self.find_by(search_keyword)
|
66
|
+
# api_array = Unirest.get("https://data.cityofchicago.org/resource/xqx5-8hwx.json?$q=#{search_keyword}").body
|
67
|
+
# end
|
68
|
+
|
69
|
+
def self.create_licenses(api_array)
|
70
|
+
licenses = []
|
71
|
+
|
72
|
+
api_array.each do |license_info|
|
73
|
+
licenses << License.new(license_info)
|
74
|
+
end
|
75
|
+
|
76
|
+
licenses
|
77
|
+
end
|
78
|
+
|
79
|
+
private_class_method :create_licenses
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chicago_business_licenses
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- nealdeters
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: unirest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.1.2
|
69
|
+
description: Allows you to access City of Chicago's Business Licenses public API from
|
70
|
+
ruby.
|
71
|
+
email:
|
72
|
+
- nealdeters@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- chicago_business_licenses.gemspec
|
87
|
+
- lib/chicago_business_licenses.rb
|
88
|
+
- lib/chicago_business_licenses/version.rb
|
89
|
+
homepage: https://github.com/nealdeters/chicago_business_licenses
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.5.1
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Wrapper for the City of Chicago Business Licenses public API
|
113
|
+
test_files: []
|