quiz_api_client 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quiz_api_client.rb +10 -0
- data/lib/quiz_api_client/http_client.rb +2 -1
- data/lib/quiz_api_client/services/jwt_service.rb +3 -3
- data/lib/quiz_api_client/services/quiz_entries_service.rb +2 -1
- data/lib/quiz_api_client/services/session_item_results_service.rb +17 -0
- data/lib/quiz_api_client/services/session_items_service.rb +16 -0
- data/lib/quiz_api_client/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9d6cea03556b8e6cdc307a635e0ab98614ce772
|
4
|
+
data.tar.gz: ca9d34355f991bed03ff7527453e810b5777128a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d3d199eef62e791bde1962d250a9454bddc272fa2e5be7a7b4d01f26ef3cd4e2b284b84678f33962d8f84067ae76fb051240baf27852511540aae4811ec70e
|
7
|
+
data.tar.gz: 6a06a1bb19beb9fff961ae4db0aa32eb2306988e3d5cab03af4c770042539d86982a602f0c94a46a952239ea86bb082020077e0d8fde1745118c6f081890d73c
|
data/lib/quiz_api_client.rb
CHANGED
@@ -52,6 +52,14 @@ module QuizApiClient
|
|
52
52
|
@_quiz_entries_service ||= Services::QuizEntriesService.new(service_params)
|
53
53
|
end
|
54
54
|
|
55
|
+
def session_items_service
|
56
|
+
@_session_items_service ||= Services::SessionItemsService.new(service_params)
|
57
|
+
end
|
58
|
+
|
59
|
+
def session_item_results_service
|
60
|
+
@_session_item_results_service ||= Services::SessionItemResultsService.new(service_params)
|
61
|
+
end
|
62
|
+
|
55
63
|
private
|
56
64
|
|
57
65
|
def service_params
|
@@ -78,3 +86,5 @@ require 'quiz_api_client/services/quiz_session_service'
|
|
78
86
|
require 'quiz_api_client/services/quiz_sessions_service'
|
79
87
|
require 'quiz_api_client/services/quizzes_service'
|
80
88
|
require 'quiz_api_client/services/quiz_session_result_service'
|
89
|
+
require 'quiz_api_client/services/session_items_service'
|
90
|
+
require 'quiz_api_client/services/session_item_results_service'
|
@@ -11,14 +11,14 @@ module QuizApiClient::Services
|
|
11
11
|
@protocol = protocol
|
12
12
|
end
|
13
13
|
|
14
|
-
def grant_permission(scope:, exp: nil,
|
14
|
+
def grant_permission(scope:, exp: nil, uuid: nil, **additional_fields)
|
15
15
|
payload = {
|
16
16
|
host: URI.parse("#{protocol}://#{host}").host,
|
17
17
|
consumer_key: consumer_key,
|
18
18
|
scope: scope,
|
19
|
-
exp: exp || Time.now.utc.to_i + 60
|
19
|
+
exp: exp || Time.now.utc.to_i + 60,
|
20
|
+
**additional_fields
|
20
21
|
}
|
21
|
-
payload[:resource_id] = resource_id if resource_id
|
22
22
|
payload[:user] = { uuid: uuid } if uuid
|
23
23
|
|
24
24
|
JWT.encode(payload, shared_secret, HASHING_ALGORITHM)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module QuizApiClient::Services
|
2
|
+
class SessionItemResultsService < BaseApiService
|
3
|
+
def list(params:, token: nil)
|
4
|
+
raise 'QuizSession Id Required' unless params && params[:quiz_session_id]
|
5
|
+
raise 'QuizSessionResult Id Required' unless params && params[:quiz_session_result_id]
|
6
|
+
get_from_quiz_api(params: params, token: token)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def get_from_quiz_api(params:, token:)
|
12
|
+
client(token: token).get(
|
13
|
+
"/api/quiz_sessions/#{params[:quiz_session_id]}/results/#{params[:quiz_session_result_id]}/session_item_results"
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module QuizApiClient::Services
|
2
|
+
class SessionItemsService < BaseApiService
|
3
|
+
def list(params:, token: nil)
|
4
|
+
raise 'QuizSession Id Required' unless params && params[:quiz_session_id]
|
5
|
+
get_from_quiz_api(params: params, token: token)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def get_from_quiz_api(params:, token:)
|
11
|
+
client(token: token).get(
|
12
|
+
"/api/quiz_sessions/#{params[:quiz_session_id]}/session_items"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
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: 1.
|
4
|
+
version: 1.1.0
|
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-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -158,6 +158,8 @@ files:
|
|
158
158
|
- lib/quiz_api_client/services/quiz_session_service.rb
|
159
159
|
- lib/quiz_api_client/services/quiz_sessions_service.rb
|
160
160
|
- lib/quiz_api_client/services/quizzes_service.rb
|
161
|
+
- lib/quiz_api_client/services/session_item_results_service.rb
|
162
|
+
- lib/quiz_api_client/services/session_items_service.rb
|
161
163
|
- lib/quiz_api_client/version.rb
|
162
164
|
- quiz_api_client.gemspec
|
163
165
|
homepage:
|