strongmind-schoology-client 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +158 -4
- data/lib/schoology_client/client.rb +56 -0
- data/lib/schoology_client/configuration.rb +12 -0
- data/lib/schoology_client/error.rb +4 -0
- data/lib/schoology_client/generators/schoology_api/install_generator.rb +18 -0
- data/lib/{schoology-client → schoology_client}/resource.rb +1 -1
- data/lib/schoology_client/resources/group.rb +12 -0
- data/lib/{schoology-client → schoology_client}/version.rb +1 -1
- data/lib/schoology_client.rb +41 -0
- data/lib/templates/rails/initializer/schoology-client.rb.tt +0 -0
- data/lib/templates/schoology_client_initializer.rb +13 -0
- metadata +65 -17
- data/lib/schoology-client/client.rb +0 -33
- data/lib/schoology-client/resources/group.rb +0 -10
- data/lib/schoology-client.rb +0 -17
- /data/lib/{schoology-client → schoology_client}/object.rb +0 -0
- /data/lib/{schoology-client → schoology_client}/objects/group.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 271745541c3bb94e1ef9eded32dd55cf25bc3d78913b02214244f33ac2fb1456
|
4
|
+
data.tar.gz: d2b1548b934b5cd2779864d22ce82417b6438eae8d6081b8e45f96f5eaf1a8ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc5cebfd760eb646c78e27693524e651dd90b63516f77d58df9c1f0bce382bf27028948504fdb63aa7e4d5d7ca572507efd3abd6f8134f816696d181e5cd4a97
|
7
|
+
data.tar.gz: 78bd3b4d61b96a38338ee5af1a554ac0cd1e199634d589eaf63963a2462893d975cdec52eb2773e1803bfeaf91783d1b7b2544a32ef97f3bc518fb38946dd93f
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.4
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,15 +1,88 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
schoology (0.1.
|
5
|
-
faraday
|
6
|
-
faraday_middleware
|
4
|
+
strongmind-schoology-client (0.1.2)
|
5
|
+
faraday (~> 1.1)
|
6
|
+
faraday_middleware (~> 1.2)
|
7
|
+
oauth (~> 1.1)
|
8
|
+
rails (~> 7.0)
|
9
|
+
railties (~> 7.0)
|
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
|
+
concurrent-ruby (1.2.2)
|
82
|
+
crass (1.0.6)
|
83
|
+
date (3.3.3)
|
12
84
|
diff-lcs (1.5.0)
|
85
|
+
erubi (1.12.0)
|
13
86
|
faraday (1.10.3)
|
14
87
|
faraday-em_http (~> 1.0)
|
15
88
|
faraday-em_synchrony (~> 1.0)
|
@@ -35,11 +108,76 @@ GEM
|
|
35
108
|
faraday-retry (1.0.3)
|
36
109
|
faraday_middleware (1.2.0)
|
37
110
|
faraday (~> 1.0)
|
111
|
+
globalid (1.1.0)
|
112
|
+
activesupport (>= 5.0)
|
113
|
+
hashie (5.0.0)
|
114
|
+
i18n (1.13.0)
|
115
|
+
concurrent-ruby (~> 1.0)
|
38
116
|
json (2.6.3)
|
117
|
+
loofah (2.20.0)
|
118
|
+
crass (~> 1.0.2)
|
119
|
+
nokogiri (>= 1.5.9)
|
120
|
+
mail (2.8.1)
|
121
|
+
mini_mime (>= 0.1.1)
|
122
|
+
net-imap
|
123
|
+
net-pop
|
124
|
+
net-smtp
|
125
|
+
marcel (1.0.2)
|
126
|
+
method_source (1.0.0)
|
127
|
+
mini_mime (1.1.2)
|
128
|
+
minitest (5.18.0)
|
39
129
|
multipart-post (2.3.0)
|
130
|
+
net-imap (0.3.4)
|
131
|
+
date
|
132
|
+
net-protocol
|
133
|
+
net-pop (0.1.2)
|
134
|
+
net-protocol
|
135
|
+
net-protocol (0.2.1)
|
136
|
+
timeout
|
137
|
+
net-smtp (0.3.3)
|
138
|
+
net-protocol
|
139
|
+
nio4r (2.5.9)
|
140
|
+
nokogiri (1.14.3-x86_64-darwin)
|
141
|
+
racc (~> 1.4)
|
142
|
+
oauth (1.1.0)
|
143
|
+
oauth-tty (~> 1.0, >= 1.0.1)
|
144
|
+
snaky_hash (~> 2.0)
|
145
|
+
version_gem (~> 1.1)
|
146
|
+
oauth-tty (1.0.5)
|
147
|
+
version_gem (~> 1.1, >= 1.1.1)
|
40
148
|
parallel (1.23.0)
|
41
149
|
parser (3.2.2.1)
|
42
150
|
ast (~> 2.4.1)
|
151
|
+
racc (1.6.2)
|
152
|
+
rack (2.2.7)
|
153
|
+
rack-test (2.1.0)
|
154
|
+
rack (>= 1.3)
|
155
|
+
rails (7.0.4.3)
|
156
|
+
actioncable (= 7.0.4.3)
|
157
|
+
actionmailbox (= 7.0.4.3)
|
158
|
+
actionmailer (= 7.0.4.3)
|
159
|
+
actionpack (= 7.0.4.3)
|
160
|
+
actiontext (= 7.0.4.3)
|
161
|
+
actionview (= 7.0.4.3)
|
162
|
+
activejob (= 7.0.4.3)
|
163
|
+
activemodel (= 7.0.4.3)
|
164
|
+
activerecord (= 7.0.4.3)
|
165
|
+
activestorage (= 7.0.4.3)
|
166
|
+
activesupport (= 7.0.4.3)
|
167
|
+
bundler (>= 1.15.0)
|
168
|
+
railties (= 7.0.4.3)
|
169
|
+
rails-dom-testing (2.0.3)
|
170
|
+
activesupport (>= 4.2.0)
|
171
|
+
nokogiri (>= 1.6)
|
172
|
+
rails-html-sanitizer (1.5.0)
|
173
|
+
loofah (~> 2.19, >= 2.19.1)
|
174
|
+
railties (7.0.4.3)
|
175
|
+
actionpack (= 7.0.4.3)
|
176
|
+
activesupport (= 7.0.4.3)
|
177
|
+
method_source
|
178
|
+
rake (>= 12.2)
|
179
|
+
thor (~> 1.0)
|
180
|
+
zeitwerk (~> 2.5)
|
43
181
|
rainbow (3.1.1)
|
44
182
|
rake (13.0.6)
|
45
183
|
regexp_parser (2.8.0)
|
@@ -71,17 +209,33 @@ GEM
|
|
71
209
|
parser (>= 3.2.1.0)
|
72
210
|
ruby-progressbar (1.13.0)
|
73
211
|
ruby2_keywords (0.0.5)
|
212
|
+
snaky_hash (2.0.1)
|
213
|
+
hashie
|
214
|
+
version_gem (~> 1.1, >= 1.1.1)
|
215
|
+
thor (1.2.1)
|
216
|
+
timeout (0.3.2)
|
217
|
+
tzinfo (2.0.6)
|
218
|
+
concurrent-ruby (~> 1.0)
|
74
219
|
unicode-display_width (2.4.2)
|
220
|
+
version_gem (1.1.2)
|
221
|
+
websocket-driver (0.7.5)
|
222
|
+
websocket-extensions (>= 0.1.0)
|
223
|
+
websocket-extensions (0.1.5)
|
224
|
+
zeitwerk (2.6.8)
|
75
225
|
|
76
226
|
PLATFORMS
|
227
|
+
arm64-darwin-22
|
77
228
|
x86_64-darwin-20
|
78
229
|
x86_64-darwin-21
|
79
230
|
|
80
231
|
DEPENDENCIES
|
232
|
+
faraday
|
233
|
+
faraday_middleware
|
234
|
+
oauth
|
81
235
|
rake (~> 13.0)
|
82
236
|
rspec (~> 3.0)
|
83
237
|
rubocop (~> 1.21)
|
84
|
-
schoology!
|
238
|
+
strongmind-schoology-client!
|
85
239
|
|
86
240
|
BUNDLED WITH
|
87
241
|
2.3.6
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'faraday'
|
3
|
+
require 'faraday_middleware'
|
4
|
+
require 'oauth'
|
5
|
+
|
6
|
+
module SchoologyClient
|
7
|
+
class Client
|
8
|
+
attr_reader :adapter, :oauth_consumer_key, :oauth_consumer_secret, :url, :stubs
|
9
|
+
|
10
|
+
def initialize(adapter: Faraday.default_adapter, stubs: nil)
|
11
|
+
@adapter = adapter
|
12
|
+
@oauth_consumer_key = SchoologyClient.configuration.oauth_consumer_key
|
13
|
+
@oauth_consumer_secret = SchoologyClient.configuration.oauth_consumer_secret
|
14
|
+
@url = SchoologyClient.configuration.url
|
15
|
+
|
16
|
+
#used for specs
|
17
|
+
@stubs = stubs
|
18
|
+
end
|
19
|
+
|
20
|
+
def group
|
21
|
+
GroupResource.new(self)
|
22
|
+
end
|
23
|
+
|
24
|
+
def connection
|
25
|
+
|
26
|
+
# Set up the OAuth 1.0 consumer
|
27
|
+
consumer = OAuth::Consumer.new(
|
28
|
+
@oauth_consumer_key,
|
29
|
+
@oauth_consumer_secret,
|
30
|
+
site: @url,
|
31
|
+
scheme: :header,
|
32
|
+
signature_method: 'PLAINTEXT',
|
33
|
+
realm: 'Schoology API'
|
34
|
+
)
|
35
|
+
|
36
|
+
# Set up the Faraday connection
|
37
|
+
connection = Faraday.new("#{@url}") do |conn|
|
38
|
+
conn.request :url_encoded
|
39
|
+
conn.request :json
|
40
|
+
|
41
|
+
conn.response :dates
|
42
|
+
conn.response :json, content_type: "application/json"
|
43
|
+
|
44
|
+
if @stubs
|
45
|
+
conn.adapter adapter, @stubs
|
46
|
+
else
|
47
|
+
conn.adapter adapter
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
return connection
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generatorsi'
|
4
|
+
require 'schoology_client'
|
5
|
+
|
6
|
+
module SchoologyApi
|
7
|
+
module Generators
|
8
|
+
class InstallGenerator < Rails::Generators::Base
|
9
|
+
source_root File.expand_path("../../templates", __FILE__)
|
10
|
+
|
11
|
+
desc "Generate SchoologyClient initializer file for Rails applications"
|
12
|
+
|
13
|
+
def copy_initializer
|
14
|
+
template "schoology_api.rb", "config/initializers/schoology_api.rb"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module SchoologyClient
|
5
|
+
class GroupResource < Resource
|
6
|
+
def create(**attributes)
|
7
|
+
response_body = post_request("groups", body: attributes.to_json).body
|
8
|
+
return GroupResource.new(response_body)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
require "faraday_middleware"
|
5
|
+
require "rails/all"
|
6
|
+
require_relative "schoology_client/version"
|
7
|
+
|
8
|
+
|
9
|
+
module SchoologyClient
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :configuration
|
13
|
+
end
|
14
|
+
|
15
|
+
autoload :Client, "schoology_client/client"
|
16
|
+
autoload :Configuration, "schoology_client/configuration"
|
17
|
+
autoload :Object, "schoology_client/object"
|
18
|
+
autoload :Resource, "schoology_client/resource"
|
19
|
+
autoload :Error, "schoology_client/error"
|
20
|
+
autoload :Railtie, "schoology_client/railtie"
|
21
|
+
|
22
|
+
# High-level categories of Schoology API calls
|
23
|
+
autoload :GroupResource, "schoology_client/resources/group"
|
24
|
+
|
25
|
+
# Classes used to return a nicer object wrapping the response data
|
26
|
+
autoload :Group, "schoology/objects/group"
|
27
|
+
|
28
|
+
def self.configuration
|
29
|
+
@configuration ||= SchoologyClient::Configuration.new
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.configure
|
33
|
+
yield(configuration)
|
34
|
+
end
|
35
|
+
|
36
|
+
def initialize
|
37
|
+
@oauth_consumer_key = self.class.configuration.oauth_consumer_key
|
38
|
+
@oauth_consumer_secret = self.class.configuration.oauth_consumer_secret
|
39
|
+
@url = self.class.configuration.url
|
40
|
+
end
|
41
|
+
end
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
SchoologyClient.configure do |config|
|
4
|
+
|
5
|
+
# Schoology OAuth consumer key and secret can be found at https://app.schoology.com/api
|
6
|
+
config.oauth_consumer_key = ENV['SCHOOLOGY_OAUTH_CONSUMER_KEY']
|
7
|
+
config.oauth_consumer_secret = ENV['SCHOOLOGY_OAUTH_CONSUMER_SECRET']
|
8
|
+
|
9
|
+
# This is the base URL for the Schoology API. It should be set to
|
10
|
+
# to something like 'https://api.schoology.com/v1'
|
11
|
+
config.url = ENV['SCHOOLOGY_API_URL']
|
12
|
+
|
13
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strongmind-schoology-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
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-
|
11
|
+
date: 2023-05-08 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: '
|
19
|
+
version: '1.1'
|
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: '
|
26
|
+
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
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.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '7.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: railties
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '7.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '7.0'
|
41
83
|
description:
|
42
84
|
email:
|
43
85
|
- qwertytalk@strongmind.com
|
@@ -47,19 +89,25 @@ 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
|
53
96
|
- Gemfile.lock
|
54
97
|
- README.md
|
55
98
|
- Rakefile
|
56
|
-
- lib/
|
57
|
-
- lib/
|
58
|
-
- lib/
|
59
|
-
- lib/
|
60
|
-
- lib/
|
61
|
-
- lib/
|
62
|
-
- lib/
|
99
|
+
- lib/schoology_client.rb
|
100
|
+
- lib/schoology_client/client.rb
|
101
|
+
- lib/schoology_client/configuration.rb
|
102
|
+
- lib/schoology_client/error.rb
|
103
|
+
- lib/schoology_client/generators/schoology_api/install_generator.rb
|
104
|
+
- lib/schoology_client/object.rb
|
105
|
+
- lib/schoology_client/objects/group.rb
|
106
|
+
- lib/schoology_client/resource.rb
|
107
|
+
- lib/schoology_client/resources/group.rb
|
108
|
+
- lib/schoology_client/version.rb
|
109
|
+
- lib/templates/rails/initializer/schoology-client.rb.tt
|
110
|
+
- lib/templates/schoology_client_initializer.rb
|
63
111
|
- sig/schoology.rbs
|
64
112
|
homepage: https://github.com/Strongmind/schoology-client
|
65
113
|
licenses: []
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SchoologyClient
|
4
|
-
class Client
|
5
|
-
BASE_URL = "https://schoologysandbox.schoology.com/v1"
|
6
|
-
|
7
|
-
attr_reader :oauth_token, :adapter
|
8
|
-
|
9
|
-
def initialize(oauth_token:, adapter: Faraday.default_adapter, stubs: nil)
|
10
|
-
@oauth_token = oauth_token
|
11
|
-
@adapter = adapter
|
12
|
-
#used for tests
|
13
|
-
@stubs = stubs
|
14
|
-
end
|
15
|
-
|
16
|
-
def group
|
17
|
-
GroupResource.new(self)
|
18
|
-
end
|
19
|
-
|
20
|
-
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
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
data/lib/schoology-client.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "faraday"
|
4
|
-
require "faraday_middleware"
|
5
|
-
require_relative "schoology-client/version"
|
6
|
-
|
7
|
-
module SchoologyClient
|
8
|
-
autoload :Client, "schoology-client/client"
|
9
|
-
autoload :Object, "schoology-client/object"
|
10
|
-
autoload :Resource, "schoology-client/resource"
|
11
|
-
|
12
|
-
# High-level categories of Schoology API calls
|
13
|
-
autoload :GroupResource, "schoology-client/resources/group"
|
14
|
-
|
15
|
-
# Classes used to return a nicer object wrapping the response data
|
16
|
-
autoload :Group, "schoology/objects/group"
|
17
|
-
end
|
File without changes
|
File without changes
|