school_digger 1.1.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5abbac302f1e78b3cd7d85af1eb3b623591b501beb04930474c54c67d55b678f
4
- data.tar.gz: 9424beef4668cc476ed75eceb780e782510a317dd7df1e680e1e17a2e01cbec3
3
+ metadata.gz: 401505886d0035377498198d8d1b6776e3145922e45cda5e4e1b432929c25e8d
4
+ data.tar.gz: 2b63de56bae3d3b64455f3144fdc53eeebed8d291677d17ac7a514f60db1cd95
5
5
  SHA512:
6
- metadata.gz: 5c29bbcde61a172c94f504b8df68644b1c36ed74ee7bbbfcc18fda5f841ba63d5e3e16bbf73e9d11ee99d15574991ad03282e7d7352ed0e8b9efca89326b387d
7
- data.tar.gz: 488bade14b09f5d2cbf691511657b7a4870a334e1d3e1ee0f5ee4d1dcd2c0ec3aadc201f84b026cf95b00723e0ac3d21ec1b781d48c41d37739b89cd41894820
6
+ metadata.gz: e3e90df3d4e5d1e99be79cc7d763df1fd43ff67ad167d4d66ab2d3c390a75df16bc638f9407eec2ec2ce9259002c463a74a061d06ab6395ce170023db76d5ade
7
+ data.tar.gz: 87521baa673557e7bb53710d8ae0418eb9cc24a1e3d7695d15b42744eccdfdfe06a357e601933ce8f82d0f700619c6157ca223a6e50700397ebe9ed9bc1f5899
data/README.md CHANGED
@@ -103,7 +103,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
103
103
 
104
104
  ## Contributing
105
105
 
106
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/school_digger. 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.
106
+ Bug reports and pull requests are welcome on GitHub at https://github.com/beneggett/school_digger. 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.
107
107
 
108
108
  ## License
109
109
 
@@ -3,13 +3,21 @@ module SchoolDigger
3
3
 
4
4
  include HTTParty
5
5
 
6
+ attr_reader :app_id, :app_key, :api_version
7
+
8
+ def initialize(options = {})
9
+ @app_id = options.fetch(:app_id, default_app_id)
10
+ @app_key = options.fetch(:app_key, default_app_key)
11
+ @api_version = options.fetch(:api_version, default_api_version)
12
+ end
13
+
6
14
  def get(path, query = {})
7
15
  response = self.class.get(school_digger_url_base + path, query: modify_query(query), timeout: 30)
8
16
  end
9
17
 
10
18
  # # SchoolDigger::Api.new.autocomplete('San Die', st: "CA")
11
19
  def autocomplete(query, options = {} )
12
- available_options = %w(q st level boxLatitudeNW boxLongitudeNW boxLatitudeSE boxLongitudeSE returnCount)
20
+ available_options = %w(q st level eSE boxLongitudeSE returnCount)
13
21
  options = options.select {|k,v| available_options.include?(k.to_s)}
14
22
  options[:q] = query
15
23
  get "/autocomplete/schools", options
@@ -86,25 +94,32 @@ module SchoolDigger
86
94
 
87
95
  def modify_query(query)
88
96
  default_params = {
89
- appID: ENV.fetch("SCHOOL_DIGGER_APP_ID", 'not-implemented'),
90
- appKey: ENV.fetch("SCHOOL_DIGGER_APP_KEY", 'not-implemented')
97
+ appID: app_id,
98
+ appKey: app_key
91
99
  }
92
100
  default_params.merge query
93
101
  end
94
102
 
103
+ def default_app_id
104
+ ENV.fetch("SCHOOL_DIGGER_APP_ID", 'not-implemented')
105
+ end
106
+
107
+ def default_app_key
108
+ ENV.fetch("SCHOOL_DIGGER_APP_KEY", 'not-implemented')
109
+ end
110
+
111
+ def default_api_version
112
+ ENV.fetch("SCHOOL_DIGGER_API_VERSION", "1.1")
113
+ end
95
114
 
96
115
  def school_digger_url_endpoint
97
116
  @school_digger_url_endpoint ||= ENV.fetch("SCHOOL_DIGGER_BASE_URL", "https://api.schooldigger.com")
98
117
  end
99
118
 
100
- def school_digger_api_version
101
- @school_digger_api_version ||= ENV.fetch("SCHOOL_DIGGER_API_VERSION", "1.1")
102
- end
103
-
119
+
104
120
  def school_digger_url_base
105
- @school_digger_url_base ||= "#{school_digger_url_endpoint}/v#{school_digger_api_version}"
121
+ @school_digger_url_base ||= "#{school_digger_url_endpoint}/v#{api_version}"
106
122
  end
107
123
 
108
-
109
124
  end
110
125
  end
@@ -1,3 +1,3 @@
1
1
  module SchoolDigger
2
- VERSION = "1.1.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
34
  spec.require_paths = ["lib"]
35
35
 
36
- spec.add_development_dependency "bundler", "~> 1.16"
36
+ spec.add_development_dependency "bundler"
37
37
  spec.add_development_dependency "rake", "~> 10.0"
38
38
  spec.add_development_dependency "minitest", "~> 5.0"
39
39
  spec.add_development_dependency "vcr"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: school_digger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-26 00:00:00.000000000 Z
11
+ date: 2024-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  requirements: []
209
- rubygems_version: 3.0.3
209
+ rubygems_version: 3.1.6
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: SchoolDigger API wrapper