openapply 1.0.3.2 → 1.0.3.6

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: dbf10a50cefd81755cc8f3bcdb2098315d82cf5c72b1b7b0678aa2cb6e0177b0
4
- data.tar.gz: 5ae83cc1a9e57bfcd82d7a77d0024da024f7fb18c70b88acf21ed3e0da290e55
3
+ metadata.gz: 54e06e0268716085179c1375a17f8af5fcea53555910d93e57b3c74cc83a48d1
4
+ data.tar.gz: 9ab858a17bc4bac531bb5089ffa5e57281bfa364548dd2d57b959275df0f9c55
5
5
  SHA512:
6
- metadata.gz: 2a96d8a7ff2f7d443a515da7d8441d4c06b7a798bf91392549fd422a9d34a3117c7d9d365a689ae07e42a2bbbad47ef2856647b780b3136bb47a12afa5fff618
7
- data.tar.gz: 55a62490b29f061976b84c59d81b5cd7ba18d96fff46b0e1eea058c31bd8a68d6c867c02f70468512a1ec72cb3ae9b17f644e9f9d7c46814b0baf1b512cc9ad1
6
+ metadata.gz: eddaee0e81d1f7cbc497485f324fc150537822e3651c9df87424a1481a4b89070617c1c258ebd2533f64cab7503e87cb0f8408d11c522a358a808997c4f3f950
7
+ data.tar.gz: ab98c2215e726e7492a1c0b6d73f8bea2f2a1598c9fcce1ff943a923080487f010e6f990538a55db2336b299450371af606323a54987053b5d73f028719dfe54
data/CHANGE_LOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ### Openapply CHANGE LOG
2
2
 
3
+ * **v1.0.3.5** - compatible with 1.0.x - 2022-08-23
4
+ - add a debug env variable to debug queries
5
+
6
+ * **v1.0.3.4** - compatible with 1.0.x - 2022-08-23
7
+ - update dependencies
8
+
3
9
  * **v1.0.2** - compatible with 1.0.x - 2020-05-18
4
10
  - improve auth token generation
5
11
 
data/Gemfile.lock CHANGED
@@ -1,84 +1,92 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openapply (1.0.3.2)
5
- httparty (~> 0.18)
6
- json (~> 2.3)
7
- oauth2 (~> 1.4)
4
+ openapply (1.0.3.6)
5
+ httparty (~> 0.20)
6
+ json (~> 2.6)
7
+ oauth2 (~> 2.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.7.0)
13
- public_suffix (>= 2.0.2, < 5.0)
12
+ addressable (2.8.1)
13
+ public_suffix (>= 2.0.2, < 6.0)
14
14
  codacy-coverage (2.2.1)
15
15
  simplecov
16
16
  coderay (1.1.3)
17
- crack (0.4.3)
18
- safe_yaml (~> 1.0.0)
19
- diff-lcs (1.4.4)
20
- docile (1.3.2)
21
- faraday (1.0.1)
22
- multipart-post (>= 1.2, < 3)
17
+ crack (0.4.5)
18
+ rexml
19
+ diff-lcs (1.5.0)
20
+ docile (1.4.0)
21
+ faraday (2.5.2)
22
+ faraday-net_http (>= 2.0, < 3.1)
23
+ ruby2_keywords (>= 0.0.4)
24
+ faraday-net_http (3.0.0)
23
25
  hashdiff (1.0.1)
24
- httparty (0.18.1)
26
+ hashie (5.0.0)
27
+ httparty (0.20.0)
25
28
  mime-types (~> 3.0)
26
29
  multi_xml (>= 0.5.2)
27
- json (2.3.1)
28
- jwt (2.2.2)
30
+ json (2.6.2)
31
+ jwt (2.4.1)
29
32
  method_source (1.0.0)
30
- mime-types (3.3.1)
33
+ mime-types (3.4.1)
31
34
  mime-types-data (~> 3.2015)
32
- mime-types-data (3.2020.0512)
33
- multi_json (1.15.0)
35
+ mime-types-data (3.2022.0105)
34
36
  multi_xml (0.6.0)
35
- multipart-post (2.1.1)
36
- oauth2 (1.4.4)
37
- faraday (>= 0.8, < 2.0)
37
+ oauth2 (2.0.7)
38
+ faraday (>= 0.17.3, < 3.0)
38
39
  jwt (>= 1.0, < 3.0)
39
- multi_json (~> 1.3)
40
40
  multi_xml (~> 0.5)
41
41
  rack (>= 1.2, < 3)
42
- pry (0.13.1)
42
+ rash_alt (>= 0.4, < 1)
43
+ version_gem (~> 1.1)
44
+ pry (0.14.1)
43
45
  coderay (~> 1.1)
44
46
  method_source (~> 1.0)
45
- public_suffix (4.0.6)
46
- rack (2.2.3)
47
- rake (13.0.1)
48
- rspec (3.9.0)
49
- rspec-core (~> 3.9.0)
50
- rspec-expectations (~> 3.9.0)
51
- rspec-mocks (~> 3.9.0)
52
- rspec-core (3.9.2)
53
- rspec-support (~> 3.9.3)
54
- rspec-expectations (3.9.2)
47
+ public_suffix (5.0.0)
48
+ rack (2.2.4)
49
+ rake (13.0.6)
50
+ rash_alt (0.4.12)
51
+ hashie (>= 3.4)
52
+ rexml (3.2.5)
53
+ rspec (3.11.0)
54
+ rspec-core (~> 3.11.0)
55
+ rspec-expectations (~> 3.11.0)
56
+ rspec-mocks (~> 3.11.0)
57
+ rspec-core (3.11.0)
58
+ rspec-support (~> 3.11.0)
59
+ rspec-expectations (3.11.0)
55
60
  diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.9.0)
57
- rspec-mocks (3.9.1)
61
+ rspec-support (~> 3.11.0)
62
+ rspec-mocks (3.11.1)
58
63
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.9.0)
60
- rspec-support (3.9.3)
61
- safe_yaml (1.0.5)
62
- simplecov (0.19.0)
64
+ rspec-support (~> 3.11.0)
65
+ rspec-support (3.11.0)
66
+ ruby2_keywords (0.0.5)
67
+ simplecov (0.21.2)
63
68
  docile (~> 1.1)
64
69
  simplecov-html (~> 0.11)
65
- simplecov-html (0.12.2)
66
- webmock (3.9.1)
67
- addressable (>= 2.3.6)
70
+ simplecov_json_formatter (~> 0.1)
71
+ simplecov-html (0.12.3)
72
+ simplecov_json_formatter (0.1.4)
73
+ version_gem (1.1.0)
74
+ webmock (3.18.1)
75
+ addressable (>= 2.8.0)
68
76
  crack (>= 0.3.2)
69
77
  hashdiff (>= 0.4.0, < 2.0.0)
70
78
 
71
79
  PLATFORMS
72
- ruby
80
+ arm64-darwin-20
73
81
 
74
82
  DEPENDENCIES
75
- bundler (~> 2.1)
76
- codacy-coverage (~> 2.1)
83
+ bundler (~> 2.3)
84
+ codacy-coverage (~> 2.2)
77
85
  openapply!
78
- pry (~> 0.13)
86
+ pry (~> 0.14)
79
87
  rake (~> 13.0)
80
- rspec (~> 3.9)
81
- webmock (~> 3.9)
88
+ rspec (~> 3.11)
89
+ webmock (~> 3.18)
82
90
 
83
91
  BUNDLED WITH
84
- 2.1.4
92
+ 2.3.20
@@ -5,6 +5,9 @@ require "openapply/put"
5
5
  require 'httparty'
6
6
 
7
7
  module Openapply
8
+ class TooManyRequestError < StandardError
9
+ end
10
+
8
11
  class Client
9
12
 
10
13
  include HTTParty # Library for API calls
@@ -12,6 +15,8 @@ module Openapply
12
15
  include Openapply::GetOneStudent # GET api calls
13
16
  include Openapply::GetManyStudents # GET api calls
14
17
 
18
+ NET_EXCEPTIONS = [Net::ReadTimeout, Net::OpenTimeout, TooManyRequestError]
19
+
15
20
  API_TIMEOUT = ENV['OA_TIMEOUT'].to_i == 0 ? 5 : ENV['OA_TIMEOUT'].to_i
16
21
  default_timeout API_TIMEOUT
17
22
 
@@ -72,8 +77,34 @@ module Openapply
72
77
  times_retried = 0
73
78
  begin
74
79
  options[:headers] = { 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8', "Authorization" => auth_token}
75
- self.class.get(url, options)
76
- rescue Net::ReadTimeout, Net::OpenTimeout
80
+
81
+ if ENV['OA_DEBUG']
82
+ puts "###"
83
+ puts "DEBUG OA CLIENT GET at #{Time.now}"
84
+ puts "request URI: #{url}"
85
+ puts "request options: #{options}"
86
+ puts "###"
87
+ end
88
+
89
+ answer = self.class.get(url, options)
90
+
91
+ if ENV['OA_DEBUG']
92
+ puts "ANSWER:"
93
+ puts "code: #{answer.code}"
94
+ puts "headers: #{answer.headers}"
95
+ puts "---"
96
+ puts "body:"
97
+ puts answer.body
98
+ puts "###"
99
+ end
100
+
101
+ raise TooManyRequestError if answer.too_many_requests?
102
+
103
+ return answer
104
+ rescue TooManyRequestError
105
+ sleep (answer.headers['X-RateLimit-Period'].to_i + 1)
106
+ retry
107
+ rescue *NET_EXCEPTIONS
77
108
  if times_retried < max_retries
78
109
  times_retried += 1
79
110
  retry
@@ -99,8 +130,30 @@ module Openapply
99
130
  begin
100
131
  options[:headers] = { 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8', "Authorization" => auth_token}
101
132
  options[:body] = value
102
- self.class.put(url, options)
103
- rescue Net::ReadTimeout, Net::OpenTimeout
133
+
134
+ if ENV['OA_DEBUG']
135
+ puts "###" if ENV['OA_DEBUG']
136
+ puts "DEBUG OA CLIENT PUT at #{Time.now}"
137
+ puts "request URI: #{url}"
138
+ puts "request options: #{options}"
139
+ puts "###"
140
+ end
141
+
142
+ answer = self.class.put(url, options)
143
+
144
+ if ENV['OA_DEBUG']
145
+ puts "ANSWER:"
146
+ puts "code: #{answer.code}"
147
+ puts "headers: #{answer.headers}"
148
+ puts "---"
149
+ puts "body:"
150
+ puts answer.body
151
+ puts "###"
152
+ end
153
+
154
+ return answer
155
+
156
+ rescue *NET_EXCEPTIONS
104
157
  if times_retried < max_retries
105
158
  times_retried += 1
106
159
  retry
@@ -161,5 +214,4 @@ module Openapply
161
214
  end
162
215
 
163
216
  end
164
-
165
217
  end
@@ -1,5 +1,5 @@
1
1
  module Openapply
2
2
  module Version
3
- VERSION = "1.0.3.2"
3
+ VERSION = "1.0.3.6"
4
4
  end
5
5
  end
data/openapply.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "openapply"
8
8
  spec.version = Openapply::Version::VERSION
9
9
  spec.authors = ["Bill Tihen", "Elliott Hébert"]
10
- spec.email = ["btihen@gmail.com","btihen@las.ch","ell.heb@container4.ch","ehebert@las.ch"]
10
+ spec.email = ["btihen@gmail.com","btihen@las.ch","ehebert@las.ch"]
11
11
 
12
12
  spec.summary = %q{Access OpenApply's APIs with Ruby}
13
13
  spec.homepage = "https://github.com/las-it/openapply"
@@ -20,14 +20,14 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency "httparty", "~> 0.18"
24
- spec.add_dependency "json" , "~> 2.3"
25
- spec.add_dependency "oauth2", "~> 1.4"
23
+ spec.add_dependency "httparty", "~> 0.20"
24
+ spec.add_dependency "json" , "~> 2.6"
25
+ spec.add_dependency "oauth2", "~> 2.0"
26
26
 
27
- spec.add_development_dependency 'codacy-coverage', '~> 2.1'
28
- spec.add_development_dependency "webmock", "~> 3.9"
29
- spec.add_development_dependency "bundler", "~> 2.1"
27
+ spec.add_development_dependency 'codacy-coverage', '~> 2.2'
28
+ spec.add_development_dependency "webmock", "~> 3.18"
29
+ spec.add_development_dependency "bundler", "~> 2.3"
30
30
  spec.add_development_dependency "rake", "~> 13.0"
31
- spec.add_development_dependency "rspec", "~> 3.9"
32
- spec.add_development_dependency "pry", "~> 0.13"
31
+ spec.add_development_dependency "rspec", "~> 3.11"
32
+ spec.add_development_dependency "pry", "~> 0.14"
33
33
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapply
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3.2
4
+ version: 1.0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Tihen
8
8
  - Elliott Hébert
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-09-16 00:00:00.000000000 Z
12
+ date: 2022-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -17,84 +17,84 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0.18'
20
+ version: '0.20'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0.18'
27
+ version: '0.20'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: json
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '2.3'
34
+ version: '2.6'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '2.3'
41
+ version: '2.6'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: oauth2
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '1.4'
48
+ version: '2.0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '1.4'
55
+ version: '2.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: codacy-coverage
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '2.1'
62
+ version: '2.2'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '2.1'
69
+ version: '2.2'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: webmock
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '3.9'
76
+ version: '3.18'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '3.9'
83
+ version: '3.18'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: bundler
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '2.1'
90
+ version: '2.3'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '2.1'
97
+ version: '2.3'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -115,33 +115,32 @@ dependencies:
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '3.9'
118
+ version: '3.11'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '3.9'
125
+ version: '3.11'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: pry
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '0.13'
132
+ version: '0.14'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '0.13'
140
- description:
139
+ version: '0.14'
140
+ description:
141
141
  email:
142
142
  - btihen@gmail.com
143
143
  - btihen@las.ch
144
- - ell.heb@container4.ch
145
144
  - ehebert@las.ch
146
145
  executables: []
147
146
  extensions: []
@@ -173,7 +172,7 @@ homepage: https://github.com/las-it/openapply
173
172
  licenses:
174
173
  - MIT
175
174
  metadata: {}
176
- post_install_message:
175
+ post_install_message:
177
176
  rdoc_options: []
178
177
  require_paths:
179
178
  - lib
@@ -188,8 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
187
  - !ruby/object:Gem::Version
189
188
  version: '0'
190
189
  requirements: []
191
- rubygems_version: 3.1.2
192
- signing_key:
190
+ rubygems_version: 3.3.20
191
+ signing_key:
193
192
  specification_version: 4
194
193
  summary: Access OpenApply's APIs with Ruby
195
194
  test_files: []