strongmind-schoology-client 0.1.0 → 0.1.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: 159bb005234f79cb05952d04e5c8df61ea13c93d39947bf324803faf291a3f43
4
- data.tar.gz: '06921f258d447fa3c5a11eddba6887b3edceb52c009af251773d908954de0796'
3
+ metadata.gz: 56a2628a8f8dda5eae583876c5310a1284d904360240ed625004b24fcf59c6b7
4
+ data.tar.gz: a6b8340d998bf65d6c17b33d3c2764eee3d027e9511ed3389f7bb13d005222ab
5
5
  SHA512:
6
- metadata.gz: 32eba4f569170e2e4ab5046b933a83e4f03caa3c5ce787f05d1a69772e1ae8c2f9bbca039dc5378c82d43a29d3f0830bce661806a54bc48b3ae7054fd9e96f43
7
- data.tar.gz: 7ce82c65442e995394e9b006d12b57f14b5e08769c129f0b29ab5f66311eefda5bfd351ee776abfbb883730dd079c575638d8937cb54e679da1ee102f7a5aad8
6
+ metadata.gz: 9708c7c9a7db17cda211539aee89cb122a56d8934aa309351aa54969edeb72b04cb7dae5fcf20ff426c401ffad1748cfb16237c27b3e630b962c67ecd526a19d
7
+ data.tar.gz: 7a254abdd176875275c775e9d648c44d8f86fd77a540a4334eb58daee1ab7568139f576aa4521ddb509e581358d0345647aaa16b844e966009f65749bebeb441
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.4
data/Gemfile CHANGED
@@ -10,3 +10,7 @@ gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
12
  gem "rubocop", "~> 1.21"
13
+
14
+ gem 'faraday'
15
+ gem 'faraday_middleware'
16
+ gem 'oauth'
data/Gemfile.lock CHANGED
@@ -1,15 +1,89 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- schoology (0.1.0)
5
- faraday
6
- faraday_middleware
4
+ strongmind-schoology-client (0.1.0)
5
+ faraday (~> 1.x)
6
+ faraday_middleware (~> 1.2)
7
+ oauth (~> 1.1)
8
+ pry
9
+ rails (~> 7.x)
7
10
 
8
11
  GEM
9
12
  remote: https://rubygems.org/
10
13
  specs:
14
+ actioncable (7.0.4.3)
15
+ actionpack (= 7.0.4.3)
16
+ activesupport (= 7.0.4.3)
17
+ nio4r (~> 2.0)
18
+ websocket-driver (>= 0.6.1)
19
+ actionmailbox (7.0.4.3)
20
+ actionpack (= 7.0.4.3)
21
+ activejob (= 7.0.4.3)
22
+ activerecord (= 7.0.4.3)
23
+ activestorage (= 7.0.4.3)
24
+ activesupport (= 7.0.4.3)
25
+ mail (>= 2.7.1)
26
+ net-imap
27
+ net-pop
28
+ net-smtp
29
+ actionmailer (7.0.4.3)
30
+ actionpack (= 7.0.4.3)
31
+ actionview (= 7.0.4.3)
32
+ activejob (= 7.0.4.3)
33
+ activesupport (= 7.0.4.3)
34
+ mail (~> 2.5, >= 2.5.4)
35
+ net-imap
36
+ net-pop
37
+ net-smtp
38
+ rails-dom-testing (~> 2.0)
39
+ actionpack (7.0.4.3)
40
+ actionview (= 7.0.4.3)
41
+ activesupport (= 7.0.4.3)
42
+ rack (~> 2.0, >= 2.2.0)
43
+ rack-test (>= 0.6.3)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
46
+ actiontext (7.0.4.3)
47
+ actionpack (= 7.0.4.3)
48
+ activerecord (= 7.0.4.3)
49
+ activestorage (= 7.0.4.3)
50
+ activesupport (= 7.0.4.3)
51
+ globalid (>= 0.6.0)
52
+ nokogiri (>= 1.8.5)
53
+ actionview (7.0.4.3)
54
+ activesupport (= 7.0.4.3)
55
+ builder (~> 3.1)
56
+ erubi (~> 1.4)
57
+ rails-dom-testing (~> 2.0)
58
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
59
+ activejob (7.0.4.3)
60
+ activesupport (= 7.0.4.3)
61
+ globalid (>= 0.3.6)
62
+ activemodel (7.0.4.3)
63
+ activesupport (= 7.0.4.3)
64
+ activerecord (7.0.4.3)
65
+ activemodel (= 7.0.4.3)
66
+ activesupport (= 7.0.4.3)
67
+ activestorage (7.0.4.3)
68
+ actionpack (= 7.0.4.3)
69
+ activejob (= 7.0.4.3)
70
+ activerecord (= 7.0.4.3)
71
+ activesupport (= 7.0.4.3)
72
+ marcel (~> 1.0)
73
+ mini_mime (>= 1.1.0)
74
+ activesupport (7.0.4.3)
75
+ concurrent-ruby (~> 1.0, >= 1.0.2)
76
+ i18n (>= 1.6, < 2)
77
+ minitest (>= 5.1)
78
+ tzinfo (~> 2.0)
11
79
  ast (2.4.2)
80
+ builder (3.2.4)
81
+ coderay (1.1.3)
82
+ concurrent-ruby (1.2.2)
83
+ crass (1.0.6)
84
+ date (3.3.3)
12
85
  diff-lcs (1.5.0)
86
+ erubi (1.12.0)
13
87
  faraday (1.10.3)
14
88
  faraday-em_http (~> 1.0)
15
89
  faraday-em_synchrony (~> 1.0)
@@ -35,11 +109,81 @@ GEM
35
109
  faraday-retry (1.0.3)
36
110
  faraday_middleware (1.2.0)
37
111
  faraday (~> 1.0)
112
+ globalid (1.1.0)
113
+ activesupport (>= 5.0)
114
+ hashie (5.0.0)
115
+ i18n (1.13.0)
116
+ concurrent-ruby (~> 1.0)
38
117
  json (2.6.3)
118
+ loofah (2.20.0)
119
+ crass (~> 1.0.2)
120
+ nokogiri (>= 1.5.9)
121
+ mail (2.8.1)
122
+ mini_mime (>= 0.1.1)
123
+ net-imap
124
+ net-pop
125
+ net-smtp
126
+ marcel (1.0.2)
127
+ method_source (1.0.0)
128
+ mini_mime (1.1.2)
129
+ minitest (5.18.0)
39
130
  multipart-post (2.3.0)
131
+ net-imap (0.3.4)
132
+ date
133
+ net-protocol
134
+ net-pop (0.1.2)
135
+ net-protocol
136
+ net-protocol (0.2.1)
137
+ timeout
138
+ net-smtp (0.3.3)
139
+ net-protocol
140
+ nio4r (2.5.9)
141
+ nokogiri (1.14.3-arm64-darwin)
142
+ racc (~> 1.4)
143
+ nokogiri (1.14.3-x86_64-darwin)
144
+ racc (~> 1.4)
145
+ oauth (1.1.0)
146
+ oauth-tty (~> 1.0, >= 1.0.1)
147
+ snaky_hash (~> 2.0)
148
+ version_gem (~> 1.1)
149
+ oauth-tty (1.0.5)
150
+ version_gem (~> 1.1, >= 1.1.1)
40
151
  parallel (1.23.0)
41
152
  parser (3.2.2.1)
42
153
  ast (~> 2.4.1)
154
+ pry (0.14.2)
155
+ coderay (~> 1.1)
156
+ method_source (~> 1.0)
157
+ racc (1.6.2)
158
+ rack (2.2.7)
159
+ rack-test (2.1.0)
160
+ rack (>= 1.3)
161
+ rails (7.0.4.3)
162
+ actioncable (= 7.0.4.3)
163
+ actionmailbox (= 7.0.4.3)
164
+ actionmailer (= 7.0.4.3)
165
+ actionpack (= 7.0.4.3)
166
+ actiontext (= 7.0.4.3)
167
+ actionview (= 7.0.4.3)
168
+ activejob (= 7.0.4.3)
169
+ activemodel (= 7.0.4.3)
170
+ activerecord (= 7.0.4.3)
171
+ activestorage (= 7.0.4.3)
172
+ activesupport (= 7.0.4.3)
173
+ bundler (>= 1.15.0)
174
+ railties (= 7.0.4.3)
175
+ rails-dom-testing (2.0.3)
176
+ activesupport (>= 4.2.0)
177
+ nokogiri (>= 1.6)
178
+ rails-html-sanitizer (1.5.0)
179
+ loofah (~> 2.19, >= 2.19.1)
180
+ railties (7.0.4.3)
181
+ actionpack (= 7.0.4.3)
182
+ activesupport (= 7.0.4.3)
183
+ method_source
184
+ rake (>= 12.2)
185
+ thor (~> 1.0)
186
+ zeitwerk (~> 2.5)
43
187
  rainbow (3.1.1)
44
188
  rake (13.0.6)
45
189
  regexp_parser (2.8.0)
@@ -71,17 +215,33 @@ GEM
71
215
  parser (>= 3.2.1.0)
72
216
  ruby-progressbar (1.13.0)
73
217
  ruby2_keywords (0.0.5)
218
+ snaky_hash (2.0.1)
219
+ hashie
220
+ version_gem (~> 1.1, >= 1.1.1)
221
+ thor (1.2.1)
222
+ timeout (0.3.2)
223
+ tzinfo (2.0.6)
224
+ concurrent-ruby (~> 1.0)
74
225
  unicode-display_width (2.4.2)
226
+ version_gem (1.1.2)
227
+ websocket-driver (0.7.5)
228
+ websocket-extensions (>= 0.1.0)
229
+ websocket-extensions (0.1.5)
230
+ zeitwerk (2.6.8)
75
231
 
76
232
  PLATFORMS
233
+ arm64-darwin-22
77
234
  x86_64-darwin-20
78
235
  x86_64-darwin-21
79
236
 
80
237
  DEPENDENCIES
238
+ faraday
239
+ faraday_middleware
240
+ oauth
81
241
  rake (~> 13.0)
82
242
  rspec (~> 3.0)
83
243
  rubocop (~> 1.21)
84
- schoology!
244
+ strongmind-schoology-client!
85
245
 
86
246
  BUNDLED WITH
87
247
  2.3.6
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
+ require 'faraday'
3
+ require 'faraday_middleware'
4
+ require 'oauth'
2
5
 
3
6
  module SchoologyClient
4
7
  class Client
5
- BASE_URL = "https://schoologysandbox.schoology.com/v1"
8
+ BASE_URL = "https://api.schoology.com/v1"
6
9
 
7
10
  attr_reader :oauth_token, :adapter
8
11
 
@@ -18,14 +21,25 @@ module SchoologyClient
18
21
  end
19
22
 
20
23
  def connection
21
- @connection ||= Faraday.new(BASE_URL) do |conn|
22
- conn.request :authorization, :Bearer, oauth_token
23
- conn.request :json
24
-
25
- conn.response :dates
26
- conn.response :json, content_type: "application/json"
27
-
28
- conn.adapter adapter, @stubs
24
+ consumer_key = "2c40b07185fbd031567affed01fcff630644fee80"
25
+ consumer_secret = "fd5863739d9f50922aa4f1cb9f4a4908"
26
+
27
+ # Set up the OAuth 1.0 consumer
28
+ consumer = OAuth::Consumer.new(
29
+ consumer_key,
30
+ consumer_secret,
31
+ site: BASE_URL,
32
+ scheme: :header,
33
+ signature_method: 'PLAINTEXT',
34
+ realm: 'Schoology API'
35
+ )
36
+
37
+ # Set up the Faraday connection
38
+ # Set up the Faraday connection
39
+ connection = Faraday.new(BASE_URL) do |conn|
40
+ conn.request :url_encoded
41
+ conn.response :json
42
+ conn.adapter Faraday.default_adapter
29
43
  end
30
44
  end
31
45
  end
@@ -0,0 +1,4 @@
1
+ module SchoologyClient
2
+ class Error < StandardError
3
+ end
4
+ end
@@ -9,7 +9,7 @@ module SchoologyClient
9
9
  end
10
10
 
11
11
  def post_request(url, body:, headers: {})
12
- handle_response client.connection.post(url, body, headers)
12
+ handle_response @client.connection.post(url, body, headers)
13
13
  end
14
14
 
15
15
  def handle_response(response)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require 'pry'
2
3
 
3
4
  module SchoologyClient
4
5
  class GroupResource < Resource
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SchoologyClient
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -2,16 +2,26 @@
2
2
 
3
3
  require "faraday"
4
4
  require "faraday_middleware"
5
+ require "rails/all"
5
6
  require_relative "schoology-client/version"
6
7
 
7
8
  module SchoologyClient
8
9
  autoload :Client, "schoology-client/client"
9
10
  autoload :Object, "schoology-client/object"
10
11
  autoload :Resource, "schoology-client/resource"
12
+ autoload :Error, "schoology-client/error"
11
13
 
12
14
  # High-level categories of Schoology API calls
13
15
  autoload :GroupResource, "schoology-client/resources/group"
14
16
 
15
17
  # Classes used to return a nicer object wrapping the response data
16
18
  autoload :Group, "schoology/objects/group"
19
+
20
+ class Railtie < Rails::Railtie
21
+ initializer 'schoology-client.insert_into_initializer' do
22
+ config_path = Rails.root.join('config/initializers/schoology-client.rb')
23
+ template_path = File.expand_path('../../templates/rails/initializer/schoology-client.rb.tt', __FILE__)
24
+ File.write(config_path, ERB.new(File.read(template_path)).result)
25
+ end
26
+ end
17
27
  end
@@ -0,0 +1,5 @@
1
+ SchoologyClient.configure |config|
2
+ config.consumer_key = ENV['SCHOOLOGY_CONSUMER_KEY']
3
+ config.consumer_secret = ENV['SCHOOLOGY_CONSUMER_SECRET']
4
+ config.url = ENV['SCHOOLOGY_URL']
5
+ end
metadata CHANGED
@@ -1,31 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-schoology-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Strongmind
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-01 00:00:00.000000000 Z
11
+ date: 2023-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.x
20
20
  type: :runtime
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: '0'
26
+ version: 1.x
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: oauth
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 7.x
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 7.x
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
29
71
  requirement: !ruby/object:Gem::Requirement
30
72
  requirements:
31
73
  - - ">="
@@ -47,6 +89,7 @@ extra_rdoc_files: []
47
89
  files:
48
90
  - ".rspec"
49
91
  - ".rubocop.yml"
92
+ - ".ruby-version"
50
93
  - CHANGELOG.md
51
94
  - CODEOWNERS
52
95
  - Gemfile
@@ -55,11 +98,13 @@ files:
55
98
  - Rakefile
56
99
  - lib/schoology-client.rb
57
100
  - lib/schoology-client/client.rb
101
+ - lib/schoology-client/error.rb
58
102
  - lib/schoology-client/object.rb
59
103
  - lib/schoology-client/objects/group.rb
60
104
  - lib/schoology-client/resource.rb
61
105
  - lib/schoology-client/resources/group.rb
62
106
  - lib/schoology-client/version.rb
107
+ - lib/templates/rails/initializer/schoology-client.rb.tt
63
108
  - sig/schoology.rbs
64
109
  homepage: https://github.com/Strongmind/schoology-client
65
110
  licenses: []