-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ability to fetch tii viewer url
- Loading branch information
Showing
9 changed files
with
140 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# freeze_string_literal: true | ||
|
||
# Fetch the eula version and html from turn it in | ||
class TiiActionGetViewUrl < TiiAction | ||
delegate :status_sym, :status, :submission_id, :submitted_by_user, :task, :idx, :similarity_pdf_id, :similarity_pdf_path, :filename, to: :entity | ||
|
||
def description | ||
"Get viewer url for #{self.filename} of #{self.task.student.username} from #{self.task.task_definition.abbreviation}" | ||
end | ||
|
||
def run | ||
result = fetch_view_url | ||
if result.present? | ||
self.complete = true | ||
result | ||
end | ||
end | ||
|
||
# Connect to tii to get the latest eula details. | ||
def fetch_view_url | ||
exec_tca_call 'fetch view url' do | ||
data = TCAClient::SimilarityViewerUrlSettings.new( | ||
viewer_user_id: params[:viewer_tii_id], | ||
locale: 'en-US', | ||
viewer_default_permission_set: "INSTRUCTOR" | ||
) | ||
|
||
api_instance = TCAClient::SimilarityApi.new | ||
report = api_instance.get_similarity_report_url( | ||
TurnItIn.x_turnitin_integration_name, | ||
TurnItIn.x_turnitin_integration_version, | ||
submission_id, | ||
data | ||
) | ||
|
||
# return the eula | ||
report.viewer_url | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters