openapply 0.4.0 → 0.4.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
  SHA256:
3
- metadata.gz: 9a8737224f666de68e77a77cd2b7b5c0a640635bcf6d1ecef71314859aa8b061
4
- data.tar.gz: fc001a7b77f3d66dbbb8b3c6cf56cf09457b1c3d4fbb86b219995b88ef92dd61
3
+ metadata.gz: a4ee6cacbef6eb99105ac78c9e04694826b438d47e84e5ea201fea38b1afd726
4
+ data.tar.gz: 0d453e0fa1de5cc230d7eeb66fddb59923e34577db1cd3dd418869cdebfc74ce
5
5
  SHA512:
6
- metadata.gz: a99d27d4feed780a81d7d6f1f3699394aab6e4cccc87057b9166021b43baf4ac41470de484f918c978d5a97882ff169a33754cc5324005d6e6ce61cef4b6ae9d
7
- data.tar.gz: 483cad9cc3d138b92a995fcd5af9a21c766b7abadceab9298fdff380eae3c9e26f363c0d1c291227e7b007da385bac1e6eec1ba38d82d05bc31b336ce44e64c1
6
+ metadata.gz: 21e601d8e4ccf3e471e8d83c9eab78b03772bd7fd3ad4a9d02d1eeb82cf9be653ec966f895e978327e306d8d506031f9c5808c4b1af620597346f7f350b6c5ba
7
+ data.tar.gz: 9d76fcb9bfcf38def07e0e72fdfa61d072a7914d26ca4354ed2c740ce12aa3aa049ebe3da61f816427a76359c5b969b8d41ee183769dd136eee2d301a398395d
data/CHANGE_LOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ### Openapply CHANGE LOG
2
2
 
3
+ * **v0.4.1** - compatible with 0.4.x - 2018-06-19
4
+ - force all openapply interactions to use https
5
+
3
6
  * **v0.4.0** - compatible with 0.3.x - 2018-06-08
4
7
  - add put ability for student id and status
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openapply (0.4.0)
4
+ openapply (0.4.1)
5
5
  httparty (~> 0.15)
6
6
  json (~> 2.1)
7
7
 
@@ -65,4 +65,4 @@ DEPENDENCIES
65
65
  webmock (~> 3.2)
66
66
 
67
67
  BUNDLED WITH
68
- 1.16.1
68
+ 1.16.2
data/examples/demo.rb CHANGED
@@ -21,6 +21,10 @@ require 'openapply'
21
21
  params = {status: 'applied'}
22
22
  summaries = @oa.many_students_summaries( params )
23
23
 
24
+ # get information details on one student
25
+ oa_id = 123456
26
+ one_details = @oa.one_student_details_by_id(oa_id)
27
+
24
28
  # get details of of many kids - after kid 95 (only get 50 records at a time)
25
29
  params = {since_id: 95, count: 50}
26
30
  kid_ids = @oa.many_students_ids( params )
@@ -11,8 +11,17 @@ module Openapply
11
11
  include Openapply::GetOneStudent # GET api calls
12
12
  include Openapply::GetManyStudents # GET api calls
13
13
 
14
- API_URL = ENV['OA_BASE_URI']
15
- API_TIMEOUT = ENV['OA_TIMEOUT'].to_i || 5
14
+
15
+ API_TIMEOUT = ENV['OA_TIMEOUT'].to_i || 5
16
+ # Force RBENV var base_uri to https://
17
+ API_URL = case
18
+ when ENV['OA_BASE_URI'].start_with?('https://')
19
+ "#{ENV['OA_BASE_URI']}"
20
+ when ENV['OA_BASE_URI'].start_with?('http://')
21
+ "#{ENV['OA_BASE_URI']}".gsub("http", "https")
22
+ else
23
+ "https://#{ENV['OA_BASE_URI']}"
24
+ end
16
25
 
17
26
  base_uri API_URL
18
27
  default_timeout API_TIMEOUT
@@ -20,7 +29,7 @@ module Openapply
20
29
  # attr_reader :api_url, :api_key
21
30
 
22
31
  def initialize
23
- api_url = ENV['OA_BASE_URI']
32
+ api_url = API_URL
24
33
  api_key = ENV['OA_AUTH_TOKEN']
25
34
 
26
35
  raise ArgumentError, 'OA_TIMEOUT is missing' if api_timeout.nil? or
@@ -34,7 +43,7 @@ module Openapply
34
43
  end
35
44
 
36
45
  def api_url
37
- ENV['OA_BASE_URI']
46
+ API_URL
38
47
  end
39
48
 
40
49
  def api_timeout
@@ -93,6 +102,8 @@ module Openapply
93
102
  self.class.put(url,
94
103
  query: query,
95
104
  headers: header )
105
+ # self.class.put(url,
106
+ # headers: header )
96
107
  rescue Net::ReadTimeout, Net::OpenTimeout
97
108
  if times_retried < max_retries
98
109
  times_retried += 1
@@ -113,10 +124,12 @@ module Openapply
113
124
  return { error: 'no url given' } if url.nil? or url.to_s.eql? ""
114
125
  return { error: 'bad url - has space' } if url&.include? " "
115
126
  return { error: 'bad api_path' } unless url&.include? "#{api_path}"
116
- return { error: 'bad auth_token' } unless url&.include? "auth_token=#{api_key}"
117
-
118
- api_answer = send(:get, url, options) if value.empty?
119
- api_answer = send(:put, url, value, options) unless value.empty?
127
+ if value.empty?
128
+ return { error: 'bad auth_token' } unless url&.include? "auth_token=#{api_key}"
129
+ api_answer = send(:get, url, options) if value.empty?
130
+ else
131
+ api_answer = send(:put, url, value, options) unless value.empty?
132
+ end
120
133
 
121
134
  return api_answer unless api_answer.respond_to? "response"
122
135
  return { error: 'no response' } if api_answer.response.nil?
data/lib/openapply/put.rb CHANGED
@@ -11,7 +11,7 @@ module Openapply
11
11
  # PUT https://<school_subdomain>.openapply.com/api/v1/students/1/student_id
12
12
  # PUT Data student_id=123456
13
13
  def update_student_id(oa_id, student_id)
14
- # url = "#{api_path}#{id}?auth_token=#{api_key}"
14
+ # url = "#{api_path}#{oa_id}?student_id=#{student_id}&auth_token=#{api_key}"
15
15
  url = "#{api_path}#{oa_id}"
16
16
  return oa_answer( url, {student_id: student_id})
17
17
  end
@@ -22,7 +22,7 @@ module Openapply
22
22
  # PUT https://<school_subdomain>.openapply.com/api/v1/students/1/status
23
23
  # PUT Data status=Applied
24
24
  def update_student_status(oa_id, status)
25
- # url = "#{api_path}#{id}/status?auth_token=#{api_key}"
25
+ # url = "#{api_path}#{oa_id}/status?auth_token=#{api_key}"
26
26
  url = "#{api_path}#{oa_id}/status"
27
27
  return oa_answer( url, {status: status})
28
28
  end
@@ -1,5 +1,5 @@
1
1
  module Openapply
2
2
  module Version
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Tihen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2018-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  requirements: []
176
176
  rubyforge_project:
177
- rubygems_version: 2.7.6
177
+ rubygems_version: 2.7.7
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: Access OpenApply's v1 API with Ruby