Sha256: 655ac2d631bcddd2a9347e96047ecb11e5b24573960a7be532b3866088793f2c
Contents?: true
Size: 1.13 KB
Versions: 16
Compression:
Stored size: 1.13 KB
Contents
module QuizApiClient::Services class QuizEntriesService < BaseApiService def create(params:, token: nil) raise 'Quiz Id Required' unless params && params[:id] post_to_quiz_api(params: params, token: token) end def list(params:, token: nil, all: false) raise 'Quiz Id Required' unless params && params[:id] get_from_quiz_api(params: params, token: token, all: all) end def destroy(params:, token: nil) raise 'Quiz Id Required' unless params && params[:quiz_id] raise 'Item Id Required' unless params && params[:id] delete_from_quiz_api(params, token) end private def post_to_quiz_api(params:, token:) client(token: token).post( "/api/quizzes/#{params[:id]}/quiz_entries", quiz_entry: params ) end def get_from_quiz_api(params:, token:, all:) client(token: token).get( "/api/quizzes/#{params[:id]}/quiz_entries", all: all ) end def delete_from_quiz_api(params, token) client(token: token).delete( "/api/quizzes/#{params[:quiz_id]}/quiz_entries/#{params[:id]}" ) end end end
Version data entries
16 entries across 16 versions & 1 rubygems