school_digger 1.0.1 → 1.2.0

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
  SHA256:
3
- metadata.gz: 5e17d65c5f2e6d411c45766286bf6039fddad144fdc7efec6434baefa2a020bd
4
- data.tar.gz: b378e9e8744b795af44d9ac22c44de8b3a800456aab8b3d8535969aa550087e8
3
+ metadata.gz: bbe4042650b2bf9d46f15e0dfa32963c529a4ffecdeb15ccae14cf11980cda64
4
+ data.tar.gz: 431c3ea4fdd09064d1a806638f3a8f14870aa403361e688e264bca3ba4ccd31b
5
5
  SHA512:
6
- metadata.gz: 5f2da22d80b14f86adbe24d7ccdf7fa46ddea8a06b4a5c385e0468a579ca2a77cd977bc17c88eda3c30807d6df3f1e721bf7acb4647c7b376b148362c6044bec
7
- data.tar.gz: 4f0938c6c90f014454dd64916abfe99d6fd986c20710bd2d718bce33285963c10b05efc566996e842d8ac4513a8ca7d89bd111cb99e62a7e27f581db3225ef5c
6
+ metadata.gz: c2c5f41d6955ed71cf0bf51b9299f5cb6dc534f6c3e58f3635b9d9f643c54e61eaadcee81cc2910ac25d3a116a90da477a842a42f7bac96e36160c3acc678fe3
7
+ data.tar.gz: 508cbc194555551151b7c3b08ec0f5901402a8af2f218a55aa35d971463c5014c39b2e978e0f82604e682ca593011d21f2c348c6c4245898310f1d5380685605
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
 
@@ -1,12 +1,17 @@
1
1
  module SchoolDigger
2
2
  class Api
3
- SCHOOL_DIGGER_URL_ENDPOINT = ENV.fetch("SCHOOL_DIGGER_BASE_URL", "https://api.schooldigger.com")
4
- SCHOOL_DIGGER_API_VERSION = ENV.fetch("SCHOOL_DIGGER_API_VERSION", "1.1")
5
- SCHOOL_DIGGER_URL_BASE = "#{SCHOOL_DIGGER_URL_ENDPOINT}/v#{SCHOOL_DIGGER_API_VERSION}"
3
+
6
4
  include HTTParty
7
5
 
6
+ attr_reader :app_id, :app_key
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
+ end
12
+
8
13
  def get(path, query = {})
9
- response = self.class.get(SCHOOL_DIGGER_URL_BASE + path, query: modify_query(query), timeout: 30)
14
+ response = self.class.get(school_digger_url_base + path, query: modify_query(query), timeout: 30)
10
15
  end
11
16
 
12
17
  # # SchoolDigger::Api.new.autocomplete('San Die', st: "CA")
@@ -88,11 +93,32 @@ module SchoolDigger
88
93
 
89
94
  def modify_query(query)
90
95
  default_params = {
91
- appID: ENV.fetch("SCHOOL_DIGGER_APP_ID", 'not-implemented'),
92
- appKey: ENV.fetch("SCHOOL_DIGGER_APP_KEY", 'not-implemented')
96
+ appID: app_id,
97
+ appKey: app_key
93
98
  }
94
99
  default_params.merge query
95
100
  end
96
101
 
102
+ def default_app_id
103
+ ENV.fetch("SCHOOL_DIGGER_APP_ID", 'not-implemented')
104
+ end
105
+
106
+ def default_app_key
107
+ ENV.fetch("SCHOOL_DIGGER_APP_KEY", 'not-implemented')
108
+ end
109
+
110
+ def school_digger_url_endpoint
111
+ @school_digger_url_endpoint ||= ENV.fetch("SCHOOL_DIGGER_BASE_URL", "https://api.schooldigger.com")
112
+ end
113
+
114
+ def school_digger_api_version
115
+ @school_digger_api_version ||= ENV.fetch("SCHOOL_DIGGER_API_VERSION", "1.1")
116
+ end
117
+
118
+ def school_digger_url_base
119
+ @school_digger_url_base ||= "#{school_digger_url_endpoint}/v#{school_digger_api_version}"
120
+ end
121
+
122
+
97
123
  end
98
124
  end
@@ -1,3 +1,3 @@
1
1
  module SchoolDigger
2
- VERSION = "1.0.1"
2
+ VERSION = "1.2.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.0.1
4
+ version: 1.2.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: 2022-11-29 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