quiz_api_client 0.1.5 → 0.1.7
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 +4 -4
- data/.gitignore +2 -0
- data/Dockerfile +11 -15
- data/README.md +9 -2
- data/build.sh +4 -6
- data/docker-compose.yml +1 -1
- data/lib/quiz_api_client/http_client.rb +0 -2
- data/lib/quiz_api_client/services/base_api_service.rb +2 -7
- data/lib/quiz_api_client/services/item_analyses_service.rb +0 -2
- data/lib/quiz_api_client/services/jwt_service.rb +2 -3
- data/lib/quiz_api_client/services/qti_imports_service.rb +0 -2
- data/lib/quiz_api_client/services/quiz_analyses_service.rb +0 -2
- data/lib/quiz_api_client/services/quiz_service.rb +0 -2
- data/lib/quiz_api_client/services/quiz_session_events_service.rb +0 -2
- data/lib/quiz_api_client/services/quiz_session_service.rb +9 -3
- data/lib/quiz_api_client/services/quiz_sessions_service.rb +0 -2
- data/lib/quiz_api_client/services/quizzes_service.rb +0 -2
- data/lib/quiz_api_client/version.rb +1 -1
- data/lib/quiz_api_client.rb +15 -10
- metadata +3 -4
- data/Gemfile.lock +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8b6d357d650b6a668514767556251baa1bb1786
|
4
|
+
data.tar.gz: 3376b2fea80424f9ed013363303d1edf56108f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2572edba5803667282c491e2c764d5b09b7121757b1afb12effcbc2ca4ee161ce5ed2cf093f1cce3530f5638ec5fa5720d40c9add67f264ee53ff565f519136
|
7
|
+
data.tar.gz: 3138426617bb189f052aa4131653a51a062bccc50232a3773409ee39227191aa9e2d62fd08c6b064610b64494247973797dcbe602d1f5c2da9febe7f1ca2bef5
|
data/.gitignore
CHANGED
data/Dockerfile
CHANGED
@@ -1,23 +1,19 @@
|
|
1
|
-
FROM instructure/
|
1
|
+
FROM instructure/rvm
|
2
2
|
|
3
|
-
USER root
|
4
|
-
|
5
|
-
RUN apt-get update \
|
6
|
-
&& apt-get install -y unzip \
|
7
|
-
&& apt-get clean \
|
8
|
-
&& rm -rf /var/lib/apt/lists/*
|
9
|
-
|
10
|
-
ENV LANG C.UTF-8
|
11
3
|
WORKDIR /app
|
12
4
|
|
13
|
-
COPY
|
14
|
-
COPY . /app
|
15
|
-
RUN chown -R docker:docker /app
|
5
|
+
COPY quiz_api_client.gemspec Gemfile /app/
|
6
|
+
COPY lib/quiz_api_client/version.rb /app/lib/quiz_api_client/version.rb
|
16
7
|
|
17
|
-
USER docker
|
18
|
-
RUN bundle install --jobs 8
|
19
8
|
USER root
|
9
|
+
RUN chown -R docker:docker /app
|
20
10
|
|
21
|
-
|
11
|
+
USER docker
|
12
|
+
RUN /bin/bash -l -c "cd /app && rvm-exec 2.4 bundle install --jobs 5"
|
13
|
+
COPY . /app
|
22
14
|
|
15
|
+
USER root
|
16
|
+
RUN chown -R docker:docker /app
|
23
17
|
USER docker
|
18
|
+
|
19
|
+
CMD /bin/bash -l -c "rvm-exec 2.4 bundle exec rspec"
|
data/README.md
CHANGED
@@ -103,9 +103,9 @@ client.quizzes_service.list(params:)
|
|
103
103
|
|
104
104
|
**Tokens**
|
105
105
|
```ruby
|
106
|
-
# Generate token:
|
106
|
+
# Generate token: Grade Quiz Session
|
107
107
|
client.quiz_session_service.token(
|
108
|
-
scope: client.quiz_session_service.
|
108
|
+
scope: client.quiz_session_service.scope_grade,
|
109
109
|
exp: some_expiration,
|
110
110
|
resource_id: quiz_session_id
|
111
111
|
)
|
@@ -116,6 +116,13 @@ client.quiz_session_service.token(
|
|
116
116
|
exp: some_expiration,
|
117
117
|
resource_id: quiz_session_id
|
118
118
|
)
|
119
|
+
|
120
|
+
# Generate token: Update Quiz Session
|
121
|
+
client.quiz_session_service.token(
|
122
|
+
scope: client.quiz_session_service.scope_update,
|
123
|
+
exp: some_expiration,
|
124
|
+
resource_id: quiz_session_id
|
125
|
+
)
|
119
126
|
```
|
120
127
|
|
121
128
|
**API Calls**
|
data/build.sh
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
export COMPOSE_PROJECT_NAME=api_client
|
1
|
+
#!/bin/bash -ex
|
4
2
|
|
5
3
|
function cleanup() {
|
6
4
|
exit_code=$?
|
7
5
|
set +e
|
8
|
-
docker cp
|
9
|
-
docker-compose
|
6
|
+
docker cp coverage:/app/coverage .
|
7
|
+
docker-compose kill
|
10
8
|
docker-compose rm -f
|
11
9
|
exit $exit_code
|
12
10
|
}
|
@@ -16,4 +14,4 @@ set -e
|
|
16
14
|
|
17
15
|
docker-compose build --pull
|
18
16
|
echo "Running test suite..."
|
19
|
-
docker-compose run --name
|
17
|
+
docker-compose run --name coverage testrunner $@
|
data/docker-compose.yml
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'quiz_api_client/http_client'
|
2
|
-
require 'quiz_api_client/services/jwt_service'
|
3
|
-
|
4
1
|
module QuizApiClient::Services
|
5
2
|
class BaseApiService
|
6
3
|
attr_reader :consumer_key, :host, :shared_secret,
|
@@ -23,9 +20,7 @@ module QuizApiClient::Services
|
|
23
20
|
end
|
24
21
|
|
25
22
|
def uri
|
26
|
-
|
27
|
-
uri.scheme = protocol
|
28
|
-
uri.to_s
|
23
|
+
URI.parse("#{protocol}://#{host}").to_s
|
29
24
|
end
|
30
25
|
|
31
26
|
def generate_token(scope:, exp: nil, resource_id: nil)
|
@@ -35,7 +30,7 @@ module QuizApiClient::Services
|
|
35
30
|
def jwt_service
|
36
31
|
QuizApiClient::Services::JwtService.new(
|
37
32
|
consumer_key: consumer_key,
|
38
|
-
host: host,
|
33
|
+
host: URI.parse("#{protocol}://#{host}").host,
|
39
34
|
shared_secret: shared_secret,
|
40
35
|
protocol: protocol
|
41
36
|
)
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jwt'
|
2
|
-
|
3
1
|
module QuizApiClient::Services
|
4
|
-
HASHING_ALGORITHM = 'HS512'.freeze
|
5
2
|
class JwtService
|
3
|
+
HASHING_ALGORITHM = 'HS512'.freeze
|
4
|
+
|
6
5
|
attr_reader :consumer_key, :host, :shared_secret, :protocol
|
7
6
|
|
8
7
|
def initialize(consumer_key: nil, shared_secret:, host:, protocol: 'https')
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'quiz_api_client/services/base_api_service'
|
2
|
-
|
3
1
|
module QuizApiClient::Services
|
4
2
|
class QuizSessionService < BaseApiService
|
5
3
|
def token(scope:, exp: nil, resource_id: nil)
|
@@ -19,6 +17,10 @@ module QuizApiClient::Services
|
|
19
17
|
'quiz_session.take'
|
20
18
|
end
|
21
19
|
|
20
|
+
def scope_grade
|
21
|
+
'quiz_session.grade'
|
22
|
+
end
|
23
|
+
|
22
24
|
private
|
23
25
|
|
24
26
|
def patch_to_quiz_api(params:, token:)
|
@@ -29,7 +31,11 @@ module QuizApiClient::Services
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def allowed_scopes
|
32
|
-
[
|
34
|
+
[
|
35
|
+
scope_grade,
|
36
|
+
scope_take,
|
37
|
+
scope_update
|
38
|
+
]
|
33
39
|
end
|
34
40
|
end
|
35
41
|
end
|
data/lib/quiz_api_client.rb
CHANGED
@@ -1,13 +1,5 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require 'quiz_api_client/services/quiz_service'
|
4
|
-
require 'quiz_api_client/services/quizzes_service'
|
5
|
-
require 'quiz_api_client/services/quiz_sessions_service'
|
6
|
-
require 'quiz_api_client/services/quiz_session_service'
|
7
|
-
require 'quiz_api_client/services/quiz_sessions_service'
|
8
|
-
require 'quiz_api_client/services/item_analyses_service'
|
9
|
-
require 'quiz_api_client/services/quiz_analyses_service'
|
10
|
-
require 'quiz_api_client/services/quiz_session_events_service'
|
1
|
+
require 'httparty'
|
2
|
+
require 'jwt'
|
11
3
|
|
12
4
|
module QuizApiClient
|
13
5
|
class Client
|
@@ -64,3 +56,16 @@ module QuizApiClient
|
|
64
56
|
end
|
65
57
|
end
|
66
58
|
end
|
59
|
+
|
60
|
+
require 'quiz_api_client/http_client'
|
61
|
+
require 'quiz_api_client/services/jwt_service'
|
62
|
+
require 'quiz_api_client/services/base_api_service'
|
63
|
+
|
64
|
+
require 'quiz_api_client/services/item_analyses_service'
|
65
|
+
require 'quiz_api_client/services/qti_imports_service'
|
66
|
+
require 'quiz_api_client/services/quiz_analyses_service'
|
67
|
+
require 'quiz_api_client/services/quiz_service'
|
68
|
+
require 'quiz_api_client/services/quiz_session_events_service'
|
69
|
+
require 'quiz_api_client/services/quiz_session_service'
|
70
|
+
require 'quiz_api_client/services/quiz_sessions_service'
|
71
|
+
require 'quiz_api_client/services/quizzes_service'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiz_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -122,7 +122,6 @@ files:
|
|
122
122
|
- ".rubocop.yml"
|
123
123
|
- Dockerfile
|
124
124
|
- Gemfile
|
125
|
-
- Gemfile.lock
|
126
125
|
- README.md
|
127
126
|
- Rakefile
|
128
127
|
- bin/console
|
@@ -162,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
161
|
version: '0'
|
163
162
|
requirements: []
|
164
163
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.5.2
|
166
165
|
signing_key:
|
167
166
|
specification_version: 4
|
168
167
|
summary: Ruby client for quiz_api
|
data/Gemfile.lock
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
quiz_api_client (0.1.5)
|
5
|
-
httparty
|
6
|
-
jwt
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.5.0)
|
12
|
-
public_suffix (~> 2.0, >= 2.0.2)
|
13
|
-
coderay (1.1.1)
|
14
|
-
crack (0.4.3)
|
15
|
-
safe_yaml (~> 1.0.0)
|
16
|
-
diff-lcs (1.3)
|
17
|
-
docile (1.1.5)
|
18
|
-
hashdiff (0.3.2)
|
19
|
-
httparty (0.14.0)
|
20
|
-
multi_xml (>= 0.5.2)
|
21
|
-
json (2.0.3)
|
22
|
-
jwt (1.5.6)
|
23
|
-
method_source (0.8.2)
|
24
|
-
multi_xml (0.6.0)
|
25
|
-
pry (0.10.4)
|
26
|
-
coderay (~> 1.1.0)
|
27
|
-
method_source (~> 0.8.1)
|
28
|
-
slop (~> 3.4)
|
29
|
-
public_suffix (2.0.5)
|
30
|
-
rake (10.4.2)
|
31
|
-
rspec (3.5.0)
|
32
|
-
rspec-core (~> 3.5.0)
|
33
|
-
rspec-expectations (~> 3.5.0)
|
34
|
-
rspec-mocks (~> 3.5.0)
|
35
|
-
rspec-core (3.5.4)
|
36
|
-
rspec-support (~> 3.5.0)
|
37
|
-
rspec-expectations (3.5.0)
|
38
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.5.0)
|
40
|
-
rspec-mocks (3.5.0)
|
41
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.5.0)
|
43
|
-
rspec-support (3.5.0)
|
44
|
-
safe_yaml (1.0.4)
|
45
|
-
simplecov (0.13.0)
|
46
|
-
docile (~> 1.1.0)
|
47
|
-
json (>= 1.8, < 3)
|
48
|
-
simplecov-html (~> 0.10.0)
|
49
|
-
simplecov-html (0.10.0)
|
50
|
-
slop (3.6.0)
|
51
|
-
webmock (2.3.2)
|
52
|
-
addressable (>= 2.3.6)
|
53
|
-
crack (>= 0.3.2)
|
54
|
-
hashdiff
|
55
|
-
|
56
|
-
PLATFORMS
|
57
|
-
ruby
|
58
|
-
|
59
|
-
DEPENDENCIES
|
60
|
-
bundler (~> 1.12)
|
61
|
-
pry
|
62
|
-
quiz_api_client!
|
63
|
-
rake (~> 10.0)
|
64
|
-
rspec (~> 3.0)
|
65
|
-
simplecov
|
66
|
-
webmock
|
67
|
-
|
68
|
-
BUNDLED WITH
|
69
|
-
1.14.3
|