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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 495e1d1a307162fa8936f613e20380bb842291c1
4
- data.tar.gz: cb5e833889a0f3291eee0046cecf5f03e3914cc8
3
+ metadata.gz: a9d6cea03556b8e6cdc307a635e0ab98614ce772
4
+ data.tar.gz: ca9d34355f991bed03ff7527453e810b5777128a
5
5
  SHA512:
6
- metadata.gz: db378349c766050f4da8f8ba9930d745c1585231d944c93dfa09f10ad67fe024c7170c1d33bb6980e1bf539d32b511bd8c20cb58cc71db7cc9a6e24149421e09
7
- data.tar.gz: cb4fec7cd16e380a062ef9bba994f9eb637d25df5788705fb9f37c8484d785c6f57b33782297a6febf7a557b43db80ac413a76757083d8823749f1f652376c3c
6
+ metadata.gz: f9d3d199eef62e791bde1962d250a9454bddc272fa2e5be7a7b4d01f26ef3cd4e2b284b84678f33962d8f84067ae76fb051240baf27852511540aae4811ec70e
7
+ data.tar.gz: 6a06a1bb19beb9fff961ae4db0aa32eb2306988e3d5cab03af4c770042539d86982a602f0c94a46a952239ea86bb082020077e0d8fde1745118c6f081890d73c
@@ -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'
@@ -50,7 +50,8 @@ module QuizApiClient
50
50
  def headers
51
51
  { 'Authorization' => jwt,
52
52
  'AuthType' => 'Signature',
53
- 'Accept' => 'application/json' }
53
+ 'Accept' => 'application/json',
54
+ 'Content-Type' => 'application/json' }
54
55
  end
55
56
  end
56
57
  end
@@ -11,14 +11,14 @@ module QuizApiClient::Services
11
11
  @protocol = protocol
12
12
  end
13
13
 
14
- def grant_permission(scope:, exp: nil, resource_id: nil, uuid: 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)
@@ -9,7 +9,8 @@ module QuizApiClient::Services
9
9
 
10
10
  def get_from_quiz_api(params:, token:)
11
11
  client(token: token).get(
12
- "/api/quizzes/#{params[:id]}/quiz_entries")
12
+ "/api/quizzes/#{params[:id]}/quiz_entries"
13
+ )
13
14
  end
14
15
  end
15
16
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  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.0.0
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-05-30 00:00:00.000000000 Z
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: