sac_county_data 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0540a3eac7d94ff27ec3ed9cebdd87fc0c059d6e
4
+ data.tar.gz: 3229fa45e9d231f720c3c037b16f8562b4faf51e
5
+ SHA512:
6
+ metadata.gz: 4db4995cd99850f67aa65a17865c72fa2c33e8965d7ac7942775a48fa90ea2be1743ed3db17b06e585d0cf0ab5eb1e6a2e272f87c40197bc7054cf9042afd565
7
+ data.tar.gz: 67b854ef759808dcd3edd88d52b2a05ca514c5b7505b88e0a5f984713297c5528a597418ec790617d0d0e5003ae9aab02a018057f5342a006bb1d8aacf2b9c3b
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sac_county_data.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Chris Cacciatore
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # SacCountyData
2
+
3
+ A Ruby interface for the Sacramento County Open Data portal.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'sac_county_data'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install sac_county_data
20
+
21
+ ## Usage
22
+
23
+ After installation you will also need to request an API key from the [Sacramento County site](http://data.saccounty.net/developers/).
24
+
25
+ ```ruby
26
+ require 'sac_county_data'
27
+
28
+ SacCountyData.configure do |config|
29
+ config.api_key = '<YOUR API KEY>'
30
+ end
31
+
32
+ # returns an array of outstanding checks
33
+ SacCountyData::OutstandingChecks.all
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/[my-github-username]/sac_county_data/fork )
38
+ 2. Create your feature branch (git checkout -b my-new-feature)
39
+ 3. Write tests
40
+ 4. Run rubocop -a
41
+ 5. Commit your changes (git commit -am 'Add some feature')
42
+ 6. Push to the branch (git push origin my-new-feature)
43
+ 7. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'lib/sac_county_data'
6
+ t.test_files = FileList['test/*_test.rb']
7
+ t.verbose = true
8
+ end
@@ -0,0 +1,26 @@
1
+ require 'faraday'
2
+ require 'json'
3
+ require 'ostruct'
4
+
5
+ module SacCountyData
6
+ class OutstandingChecks
7
+ RESOURCE_URL = 'OUTST-CHECK-FROM-COUNT-OF/data.json'.freeze
8
+ def self.all
9
+ objs = []
10
+
11
+ response = Faraday.get("#{API_URL}/#{RESOURCE_URL}/?auth_key=#{SacCountyData.api_key}")
12
+ a = JSON.parse(response.body)['result']['fArray']
13
+ a.each_slice(8) do |s|
14
+ obj = {}
15
+ obj[:date] = s[4]['fStr']
16
+ obj[:number] = s[5]['fStr']
17
+ obj[:amount] = s[6]['fStr']
18
+ obj[:name] = s[7]['fStr']
19
+
20
+ objs.push OpenStruct.new obj
21
+ end
22
+
23
+ objs
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module SacCountyData
2
+ VERSION = '0.0.1'.freeze
3
+ end
@@ -0,0 +1,15 @@
1
+ require 'sac_county_data/version'
2
+
3
+ require_relative 'sac_county_data/outstanding_checks'
4
+
5
+ module SacCountyData
6
+ API_URL = 'http://saccounty.cloudapi.junar.com/api/v2/datastreams'.freeze
7
+ module Configuration
8
+ attr_accessor :api_key
9
+
10
+ def configure
11
+ yield self
12
+ end
13
+ end
14
+ extend Configuration
15
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sac_county_data/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'sac_county_data'
8
+ spec.version = SacCountyData::VERSION
9
+ spec.authors = ['Chris Cacciatore']
10
+ spec.email = ['chris.cacciatore@gmail.com']
11
+ spec.summary = 'A Ruby interface for the Sac County Open Data portal.'
12
+ spec.description = ''
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'rubocop', '~> 0.34'
24
+ spec.add_development_dependency 'minitest', '~> 5.8'
25
+
26
+ spec.add_dependency 'faraday', '~> 0.9'
27
+ spec.add_dependency 'json', '~> 1.8'
28
+ end
@@ -0,0 +1,19 @@
1
+ require './test/test_helper'
2
+
3
+ describe 'SacCountyData::OutstandingChecks' do
4
+ before do
5
+ SacCountyData.configure do |config|
6
+ config.api_key = ''
7
+ end
8
+ end
9
+
10
+ it 'should exist for sure' do
11
+ assert SacCountyData::OutstandingChecks
12
+ end
13
+
14
+ it 'should return all outstanding checks' do
15
+ checks = SacCountyData::OutstandingChecks.all
16
+
17
+ assert checks.is_a? Array
18
+ end
19
+ end
@@ -0,0 +1,2 @@
1
+ require './lib/sac_county_data'
2
+ require 'minitest/autorun'
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sac_county_data
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Chris Cacciatore
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-05 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
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: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.34'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.34'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.9'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: json
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.8'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.8'
97
+ description: ''
98
+ email:
99
+ - chris.cacciatore@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - lib/sac_county_data.rb
110
+ - lib/sac_county_data/outstanding_checks.rb
111
+ - lib/sac_county_data/version.rb
112
+ - sac_county_data.gemspec
113
+ - test/outstanding_checks_test.rb
114
+ - test/test_helper.rb
115
+ homepage: ''
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.4.5
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: A Ruby interface for the Sac County Open Data portal.
139
+ test_files:
140
+ - test/outstanding_checks_test.rb
141
+ - test/test_helper.rb