shortcut_client_ruby 0.0.4 → 0.1.2
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/Gemfile.lock +74 -0
- data/README.md +31 -1986
- data/Rakefile +2 -0
- data/bin/update.rb +8 -4
- data/config.json +2 -1
- data/docs/BasicWorkspaceInfo.md +16 -4
- data/docs/Branch.md +34 -13
- data/docs/Category.md +30 -11
- data/docs/Commit.md +38 -15
- data/docs/CreateCategory.md +20 -6
- data/docs/CreateCategoryParams.md +18 -5
- data/docs/CreateCommentComment.md +22 -7
- data/docs/CreateEntityTemplate.md +18 -5
- data/docs/CreateEpic.md +46 -19
- data/docs/CreateEpicComment.md +22 -7
- data/docs/CreateGroup.md +28 -10
- data/docs/CreateIteration.md +26 -9
- data/docs/CreateLabelParams.md +20 -6
- data/docs/CreateLinkedFile.md +30 -11
- data/docs/CreateMilestone.md +24 -8
- data/docs/CreateOrDeleteStoryReaction.md +14 -3
- data/docs/CreateProject.md +34 -13
- data/docs/CreateStories.md +14 -3
- data/docs/CreateStoryComment.md +22 -7
- data/docs/CreateStoryCommentParams.md +22 -7
- data/docs/CreateStoryContents.md +54 -23
- data/docs/CreateStoryLink.md +18 -5
- data/docs/CreateStoryLinkParams.md +18 -5
- data/docs/CreateStoryParams.md +66 -29
- data/docs/CreateTask.md +24 -8
- data/docs/CreateTaskParams.md +24 -8
- data/docs/DefaultApi.md +3569 -1641
- data/docs/DeleteStories.md +14 -3
- data/docs/EntityTemplate.md +28 -10
- data/docs/EntityTemplateTask.md +20 -6
- data/docs/Epic.md +88 -40
- data/docs/EpicSearchResults.md +20 -6
- data/docs/EpicSlim.md +86 -39
- data/docs/EpicState.md +30 -11
- data/docs/EpicStats.md +38 -15
- data/docs/EpicWorkflow.md +24 -8
- data/docs/GetEpicStories.md +14 -3
- data/docs/GetExternalLinkStoriesParams.md +14 -3
- data/docs/GetIterationStories.md +14 -3
- data/docs/GetLabelStories.md +14 -3
- data/docs/GetMember.md +14 -3
- data/docs/GetProjectStories.md +14 -3
- data/docs/Group.md +44 -18
- data/docs/History.md +30 -11
- data/docs/HistoryActionBranchCreate.md +22 -7
- data/docs/HistoryActionBranchMerge.md +22 -7
- data/docs/HistoryActionBranchPush.md +22 -7
- data/docs/HistoryActionLabelCreate.md +22 -7
- data/docs/HistoryActionLabelDelete.md +20 -6
- data/docs/HistoryActionLabelUpdate.md +18 -5
- data/docs/HistoryActionProjectUpdate.md +22 -7
- data/docs/HistoryActionPullRequest.md +24 -8
- data/docs/HistoryActionStoryCommentCreate.md +24 -8
- data/docs/HistoryActionStoryCreate.md +60 -26
- data/docs/HistoryActionStoryDelete.md +22 -7
- data/docs/HistoryActionStoryLinkCreate.md +24 -8
- data/docs/HistoryActionStoryLinkDelete.md +24 -8
- data/docs/HistoryActionStoryLinkUpdate.md +26 -9
- data/docs/HistoryActionStoryUpdate.md +26 -9
- data/docs/HistoryActionTaskCreate.md +30 -11
- data/docs/HistoryActionTaskDelete.md +20 -6
- data/docs/HistoryActionTaskUpdate.md +26 -9
- data/docs/HistoryChangesStory.md +60 -26
- data/docs/HistoryChangesStoryLink.md +18 -5
- data/docs/HistoryChangesTask.md +20 -6
- data/docs/HistoryReferenceBranch.md +20 -6
- data/docs/HistoryReferenceCommit.md +20 -6
- data/docs/HistoryReferenceEpic.md +20 -6
- data/docs/HistoryReferenceGeneral.md +18 -5
- data/docs/HistoryReferenceGroup.md +18 -5
- data/docs/HistoryReferenceIteration.md +20 -6
- data/docs/HistoryReferenceLabel.md +20 -6
- data/docs/HistoryReferenceProject.md +20 -6
- data/docs/HistoryReferenceStory.md +22 -7
- data/docs/HistoryReferenceStoryTask.md +18 -5
- data/docs/HistoryReferenceWorkflowState.md +20 -6
- data/docs/Icon.md +22 -7
- data/docs/Identity.md +18 -5
- data/docs/Iteration.md +48 -20
- data/docs/IterationSlim.md +46 -19
- data/docs/IterationStats.md +34 -13
- data/docs/Label.md +34 -13
- data/docs/LabelSlim.md +32 -12
- data/docs/LabelStats.md +42 -17
- data/docs/LinkedFile.md +44 -18
- data/docs/ListEpics.md +14 -3
- data/docs/ListGroupStories.md +16 -4
- data/docs/ListLabels.md +14 -3
- data/docs/ListMembers.md +14 -3
- data/docs/MaxSearchResultsExceededError.md +18 -5
- data/docs/Member.md +34 -13
- data/docs/MemberInfo.md +20 -6
- data/docs/Milestone.md +46 -19
- data/docs/MilestoneStats.md +18 -5
- data/docs/Profile.md +30 -11
- data/docs/Project.md +50 -21
- data/docs/ProjectStats.md +18 -5
- data/docs/PullRequest.md +56 -24
- data/docs/PullRequestLabel.md +22 -7
- data/docs/Repository.md +30 -11
- data/docs/Search.md +20 -6
- data/docs/SearchResults.md +16 -4
- data/docs/SearchStories.md +68 -30
- data/docs/Story.md +112 -52
- data/docs/StoryComment.md +40 -16
- data/docs/StoryContents.md +50 -21
- data/docs/StoryContentsTask.md +22 -7
- data/docs/StoryHistoryChangeAddsRemovesInt.md +16 -4
- data/docs/StoryHistoryChangeAddsRemovesUuid.md +16 -4
- data/docs/StoryHistoryChangeOldNewBool.md +16 -4
- data/docs/StoryHistoryChangeOldNewInt.md +16 -4
- data/docs/StoryHistoryChangeOldNewStr.md +16 -4
- data/docs/StoryHistoryChangeOldNewUuid.md +16 -4
- data/docs/StoryLink.md +28 -10
- data/docs/StoryReaction.md +16 -4
- data/docs/StorySearchResults.md +20 -6
- data/docs/StorySlim.md +108 -50
- data/docs/StoryStats.md +14 -3
- data/docs/Task.md +40 -16
- data/docs/ThreadedComment.md +38 -15
- data/docs/TypedStoryLink.md +30 -11
- data/docs/UnusableEntitlementError.md +18 -5
- data/docs/UpdateCategory.md +18 -5
- data/docs/UpdateComment.md +14 -3
- data/docs/UpdateEntityTemplate.md +16 -4
- data/docs/UpdateEpic.md +46 -19
- data/docs/UpdateFile.md +24 -8
- data/docs/UpdateGroup.md +30 -11
- data/docs/UpdateIteration.md +26 -9
- data/docs/UpdateLabel.md +20 -6
- data/docs/UpdateLinkedFile.md +28 -10
- data/docs/UpdateMilestone.md +28 -10
- data/docs/UpdateProject.md +30 -11
- data/docs/UpdateStories.md +54 -23
- data/docs/UpdateStory.md +64 -28
- data/docs/UpdateStoryComment.md +14 -3
- data/docs/UpdateStoryContents.md +54 -23
- data/docs/UpdateStoryLink.md +18 -5
- data/docs/UpdateTask.md +22 -7
- data/docs/UploadedFile.md +46 -19
- data/docs/Workflow.md +34 -13
- data/docs/WorkflowState.md +36 -14
- data/git_push.sh +11 -9
- data/lib/shortcut_client_ruby/api/default_api.rb +2119 -1248
- data/lib/shortcut_client_ruby/api_client.rb +143 -106
- data/lib/shortcut_client_ruby/api_error.rb +4 -4
- data/lib/shortcut_client_ruby/configuration.rb +163 -32
- data/lib/shortcut_client_ruby/models/basic_workspace_info.rb +26 -13
- data/lib/shortcut_client_ruby/models/branch.rb +35 -42
- data/lib/shortcut_client_ruby/models/category.rb +57 -28
- data/lib/shortcut_client_ruby/models/commit.rb +37 -44
- data/lib/shortcut_client_ruby/models/create_category.rb +90 -17
- data/lib/shortcut_client_ruby/models/create_category_params.rb +87 -14
- data/lib/shortcut_client_ruby/models/create_comment_comment.rb +57 -16
- data/lib/shortcut_client_ruby/models/create_entity_template.rb +46 -14
- data/lib/shortcut_client_ruby/models/create_epic.rb +86 -30
- data/lib/shortcut_client_ruby/models/create_epic_comment.rb +57 -16
- data/lib/shortcut_client_ruby/models/create_group.rb +104 -21
- data/lib/shortcut_client_ruby/models/create_iteration.rb +103 -18
- data/lib/shortcut_client_ruby/models/create_label_params.rb +97 -15
- data/lib/shortcut_client_ruby/models/create_linked_file.rb +110 -22
- data/lib/shortcut_client_ruby/models/create_milestone.rb +75 -19
- data/lib/shortcut_client_ruby/models/create_or_delete_story_reaction.rb +25 -12
- data/lib/shortcut_client_ruby/models/create_project.rb +104 -22
- data/lib/shortcut_client_ruby/models/create_stories.rb +25 -12
- data/lib/shortcut_client_ruby/models/create_story_comment.rb +48 -16
- data/lib/shortcut_client_ruby/models/create_story_comment_params.rb +48 -16
- data/lib/shortcut_client_ruby/models/create_story_contents.rb +57 -32
- data/lib/shortcut_client_ruby/models/create_story_link.rb +29 -16
- data/lib/shortcut_client_ruby/models/create_story_link_params.rb +29 -16
- data/lib/shortcut_client_ruby/models/create_story_params.rb +120 -40
- data/lib/shortcut_client_ruby/models/create_task.rb +30 -17
- data/lib/shortcut_client_ruby/models/create_task_params.rb +30 -17
- data/lib/shortcut_client_ruby/models/delete_stories.rb +35 -12
- data/lib/shortcut_client_ruby/models/entity_template.rb +32 -19
- data/lib/shortcut_client_ruby/models/entity_template_task.rb +28 -15
- data/lib/shortcut_client_ruby/models/epic.rb +62 -124
- data/lib/shortcut_client_ruby/models/epic_search_results.rb +28 -20
- data/lib/shortcut_client_ruby/models/epic_slim.rb +61 -123
- data/lib/shortcut_client_ruby/models/epic_state.rb +59 -20
- data/lib/shortcut_client_ruby/models/epic_stats.rb +37 -29
- data/lib/shortcut_client_ruby/models/epic_workflow.rb +30 -17
- data/lib/shortcut_client_ruby/models/get_epic_stories.rb +25 -12
- data/lib/shortcut_client_ruby/models/get_external_link_stories_params.rb +55 -12
- data/lib/shortcut_client_ruby/models/get_iteration_stories.rb +25 -12
- data/lib/shortcut_client_ruby/models/get_label_stories.rb +25 -12
- data/lib/shortcut_client_ruby/models/get_member.rb +25 -12
- data/lib/shortcut_client_ruby/models/get_project_stories.rb +25 -12
- data/lib/shortcut_client_ruby/models/group.rb +96 -37
- data/lib/shortcut_client_ruby/models/history.rb +35 -22
- data/lib/shortcut_client_ruby/models/history_action_branch_create.rb +31 -18
- data/lib/shortcut_client_ruby/models/history_action_branch_merge.rb +31 -18
- data/lib/shortcut_client_ruby/models/history_action_branch_push.rb +31 -18
- data/lib/shortcut_client_ruby/models/history_action_label_create.rb +61 -18
- data/lib/shortcut_client_ruby/models/history_action_label_delete.rb +30 -17
- data/lib/shortcut_client_ruby/models/history_action_label_update.rb +29 -16
- data/lib/shortcut_client_ruby/models/history_action_project_update.rb +61 -18
- data/lib/shortcut_client_ruby/models/history_action_pull_request.rb +62 -19
- data/lib/shortcut_client_ruby/models/history_action_story_comment_create.rb +62 -19
- data/lib/shortcut_client_ruby/models/history_action_story_create.rb +82 -39
- data/lib/shortcut_client_ruby/models/history_action_story_delete.rb +33 -20
- data/lib/shortcut_client_ruby/models/history_action_story_link_create.rb +34 -21
- data/lib/shortcut_client_ruby/models/history_action_story_link_delete.rb +34 -31
- data/lib/shortcut_client_ruby/models/history_action_story_link_update.rb +35 -22
- data/lib/shortcut_client_ruby/models/history_action_story_update.rb +65 -22
- data/lib/shortcut_client_ruby/models/history_action_task_create.rb +35 -22
- data/lib/shortcut_client_ruby/models/history_action_task_delete.rb +30 -17
- data/lib/shortcut_client_ruby/models/history_action_task_update.rb +33 -20
- data/lib/shortcut_client_ruby/models/history_changes_story.rb +48 -35
- data/lib/shortcut_client_ruby/models/history_changes_story_link.rb +27 -14
- data/lib/shortcut_client_ruby/models/history_changes_task.rb +28 -15
- data/lib/shortcut_client_ruby/models/history_reference_branch.rb +58 -15
- data/lib/shortcut_client_ruby/models/history_reference_commit.rb +58 -15
- data/lib/shortcut_client_ruby/models/history_reference_epic.rb +58 -15
- data/lib/shortcut_client_ruby/models/history_reference_general.rb +27 -14
- data/lib/shortcut_client_ruby/models/history_reference_group.rb +27 -14
- data/lib/shortcut_client_ruby/models/history_reference_iteration.rb +58 -15
- data/lib/shortcut_client_ruby/models/history_reference_label.rb +58 -15
- data/lib/shortcut_client_ruby/models/history_reference_project.rb +58 -15
- data/lib/shortcut_client_ruby/models/history_reference_story.rb +61 -18
- data/lib/shortcut_client_ruby/models/history_reference_story_task.rb +27 -14
- data/lib/shortcut_client_ruby/models/history_reference_workflow_state.rb +30 -17
- data/lib/shortcut_client_ruby/models/icon.rb +29 -16
- data/lib/shortcut_client_ruby/models/identity.rb +27 -24
- data/lib/shortcut_client_ruby/models/iteration.rb +42 -29
- data/lib/shortcut_client_ruby/models/iteration_slim.rb +41 -28
- data/lib/shortcut_client_ruby/models/iteration_stats.rb +35 -22
- data/lib/shortcut_client_ruby/models/label.rb +59 -45
- data/lib/shortcut_client_ruby/models/label_slim.rb +58 -44
- data/lib/shortcut_client_ruby/models/label_stats.rb +39 -26
- data/lib/shortcut_client_ruby/models/linked_file.rb +40 -47
- data/lib/shortcut_client_ruby/models/list_epics.rb +25 -12
- data/lib/shortcut_client_ruby/models/list_group_stories.rb +26 -13
- data/lib/shortcut_client_ruby/models/list_labels.rb +25 -12
- data/lib/shortcut_client_ruby/models/list_members.rb +25 -12
- data/lib/shortcut_client_ruby/models/max_search_results_exceeded_error.rb +31 -18
- data/lib/shortcut_client_ruby/models/member.rb +37 -34
- data/lib/shortcut_client_ruby/models/member_info.rb +28 -15
- data/lib/shortcut_client_ruby/models/milestone.rb +41 -48
- data/lib/shortcut_client_ruby/models/milestone_stats.rb +27 -14
- data/lib/shortcut_client_ruby/models/profile.rb +33 -35
- data/lib/shortcut_client_ruby/models/project.rb +67 -58
- data/lib/shortcut_client_ruby/models/project_stats.rb +27 -14
- data/lib/shortcut_client_ruby/models/pull_request.rb +46 -43
- data/lib/shortcut_client_ruby/models/pull_request_label.rb +59 -16
- data/lib/shortcut_client_ruby/models/repository.rb +33 -55
- data/lib/shortcut_client_ruby/models/search.rb +49 -17
- data/lib/shortcut_client_ruby/models/search_results.rb +26 -13
- data/lib/shortcut_client_ruby/models/search_stories.rb +105 -41
- data/lib/shortcut_client_ruby/models/story.rb +74 -131
- data/lib/shortcut_client_ruby/models/story_comment.rb +38 -40
- data/lib/shortcut_client_ruby/models/story_contents.rb +43 -30
- data/lib/shortcut_client_ruby/models/story_contents_task.rb +29 -16
- data/lib/shortcut_client_ruby/models/story_history_change_adds_removes_int.rb +26 -13
- data/lib/shortcut_client_ruby/models/story_history_change_adds_removes_uuid.rb +26 -13
- data/lib/shortcut_client_ruby/models/story_history_change_old_new_bool.rb +26 -13
- data/lib/shortcut_client_ruby/models/story_history_change_old_new_int.rb +26 -13
- data/lib/shortcut_client_ruby/models/story_history_change_old_new_str.rb +26 -13
- data/lib/shortcut_client_ruby/models/story_history_change_old_new_uuid.rb +26 -13
- data/lib/shortcut_client_ruby/models/story_link.rb +32 -19
- data/lib/shortcut_client_ruby/models/story_reaction.rb +26 -13
- data/lib/shortcut_client_ruby/models/story_search_results.rb +28 -20
- data/lib/shortcut_client_ruby/models/story_slim.rb +72 -129
- data/lib/shortcut_client_ruby/models/story_stats.rb +25 -12
- data/lib/shortcut_client_ruby/models/task.rb +38 -40
- data/lib/shortcut_client_ruby/models/threaded_comment.rb +37 -29
- data/lib/shortcut_client_ruby/models/typed_story_link.rb +33 -20
- data/lib/shortcut_client_ruby/models/unusable_entitlement_error.rb +85 -16
- data/lib/shortcut_client_ruby/models/update_category.rb +68 -14
- data/lib/shortcut_client_ruby/models/update_comment.rb +25 -12
- data/lib/shortcut_client_ruby/models/update_entity_template.rb +41 -13
- data/lib/shortcut_client_ruby/models/update_epic.rb +82 -30
- data/lib/shortcut_client_ruby/models/update_file.rb +54 -17
- data/lib/shortcut_client_ruby/models/update_group.rb +97 -22
- data/lib/shortcut_client_ruby/models/update_iteration.rb +91 -18
- data/lib/shortcut_client_ruby/models/update_label.rb +78 -15
- data/lib/shortcut_client_ruby/models/update_linked_file.rb +101 -21
- data/lib/shortcut_client_ruby/models/update_milestone.rb +73 -21
- data/lib/shortcut_client_ruby/models/update_project.rb +98 -20
- data/lib/shortcut_client_ruby/models/update_stories.rb +83 -36
- data/lib/shortcut_client_ruby/models/update_story.rb +135 -41
- data/lib/shortcut_client_ruby/models/update_story_comment.rb +44 -12
- data/lib/shortcut_client_ruby/models/update_story_contents.rb +57 -32
- data/lib/shortcut_client_ruby/models/update_story_link.rb +29 -16
- data/lib/shortcut_client_ruby/models/update_task.rb +29 -16
- data/lib/shortcut_client_ruby/models/uploaded_file.rb +41 -53
- data/lib/shortcut_client_ruby/models/workflow.rb +35 -22
- data/lib/shortcut_client_ruby/models/workflow_state.rb +60 -26
- data/lib/shortcut_client_ruby/version.rb +5 -4
- data/lib/shortcut_client_ruby.rb +4 -4
- data/openapi-generator-cli.jar +0 -0
- data/shortcut_client_ruby-0.0.4.gem +0 -0
- data/shortcut_client_ruby.gemspec +7 -6
- data/spec/api/default_api_spec.rb +64 -63
- data/spec/api_client_spec.rb +7 -44
- data/spec/configuration_spec.rb +7 -6
- data/spec/models/basic_workspace_info_spec.rb +8 -14
- data/spec/models/branch_spec.rb +8 -14
- data/spec/models/category_spec.rb +8 -14
- data/spec/models/commit_spec.rb +8 -14
- data/spec/models/create_category_params_spec.rb +8 -14
- data/spec/models/create_category_spec.rb +9 -15
- data/spec/models/create_comment_comment_spec.rb +8 -14
- data/spec/models/create_entity_template_spec.rb +8 -14
- data/spec/models/create_epic_comment_spec.rb +8 -14
- data/spec/models/create_epic_spec.rb +9 -15
- data/spec/models/create_group_spec.rb +9 -15
- data/spec/models/create_iteration_spec.rb +8 -14
- data/spec/models/create_label_params_spec.rb +8 -14
- data/spec/models/create_linked_file_spec.rb +9 -15
- data/spec/models/create_milestone_spec.rb +9 -15
- data/spec/models/create_or_delete_story_reaction_spec.rb +8 -14
- data/spec/models/create_project_spec.rb +8 -14
- data/spec/models/create_stories_spec.rb +8 -14
- data/spec/models/create_story_comment_params_spec.rb +8 -14
- data/spec/models/create_story_comment_spec.rb +8 -14
- data/spec/models/create_story_contents_spec.rb +8 -14
- data/spec/models/create_story_link_params_spec.rb +9 -15
- data/spec/models/create_story_link_spec.rb +9 -15
- data/spec/models/create_story_params_spec.rb +9 -15
- data/spec/models/create_task_params_spec.rb +8 -14
- data/spec/models/create_task_spec.rb +8 -14
- data/spec/models/delete_stories_spec.rb +8 -14
- data/spec/models/entity_template_spec.rb +8 -14
- data/spec/models/entity_template_task_spec.rb +8 -14
- data/spec/models/epic_search_results_spec.rb +8 -14
- data/spec/models/epic_slim_spec.rb +8 -14
- data/spec/models/epic_spec.rb +8 -14
- data/spec/models/epic_state_spec.rb +8 -14
- data/spec/models/epic_stats_spec.rb +8 -14
- data/spec/models/epic_workflow_spec.rb +8 -14
- data/spec/models/get_epic_stories_spec.rb +8 -14
- data/spec/models/get_external_link_stories_params_spec.rb +8 -14
- data/spec/models/get_iteration_stories_spec.rb +8 -14
- data/spec/models/get_label_stories_spec.rb +8 -14
- data/spec/models/get_member_spec.rb +8 -14
- data/spec/models/get_project_stories_spec.rb +8 -14
- data/spec/models/group_spec.rb +9 -15
- data/spec/models/history_action_branch_create_spec.rb +9 -15
- data/spec/models/history_action_branch_merge_spec.rb +9 -15
- data/spec/models/history_action_branch_push_spec.rb +9 -15
- data/spec/models/history_action_label_create_spec.rb +9 -15
- data/spec/models/history_action_label_delete_spec.rb +9 -15
- data/spec/models/history_action_label_update_spec.rb +9 -15
- data/spec/models/history_action_project_update_spec.rb +9 -15
- data/spec/models/history_action_pull_request_spec.rb +9 -15
- data/spec/models/history_action_story_comment_create_spec.rb +9 -15
- data/spec/models/history_action_story_create_spec.rb +10 -16
- data/spec/models/history_action_story_delete_spec.rb +10 -16
- data/spec/models/history_action_story_link_create_spec.rb +10 -16
- data/spec/models/history_action_story_link_delete_spec.rb +10 -16
- data/spec/models/history_action_story_link_update_spec.rb +10 -16
- data/spec/models/history_action_story_update_spec.rb +10 -16
- data/spec/models/history_action_task_create_spec.rb +9 -15
- data/spec/models/history_action_task_delete_spec.rb +9 -15
- data/spec/models/history_action_task_update_spec.rb +9 -15
- data/spec/models/history_changes_story_link_spec.rb +8 -14
- data/spec/models/history_changes_story_spec.rb +8 -14
- data/spec/models/history_changes_task_spec.rb +8 -14
- data/spec/models/history_reference_branch_spec.rb +8 -14
- data/spec/models/history_reference_commit_spec.rb +8 -14
- data/spec/models/history_reference_epic_spec.rb +8 -14
- data/spec/models/history_reference_general_spec.rb +8 -14
- data/spec/models/history_reference_group_spec.rb +8 -14
- data/spec/models/history_reference_iteration_spec.rb +8 -14
- data/spec/models/history_reference_label_spec.rb +8 -14
- data/spec/models/history_reference_project_spec.rb +8 -14
- data/spec/models/history_reference_story_spec.rb +9 -15
- data/spec/models/history_reference_story_task_spec.rb +8 -14
- data/spec/models/history_reference_workflow_state_spec.rb +9 -15
- data/spec/models/history_spec.rb +9 -15
- data/spec/models/icon_spec.rb +8 -14
- data/spec/models/identity_spec.rb +8 -14
- data/spec/models/iteration_slim_spec.rb +8 -14
- data/spec/models/iteration_spec.rb +8 -14
- data/spec/models/iteration_stats_spec.rb +8 -14
- data/spec/models/label_slim_spec.rb +8 -14
- data/spec/models/label_spec.rb +8 -14
- data/spec/models/label_stats_spec.rb +8 -14
- data/spec/models/linked_file_spec.rb +8 -14
- data/spec/models/list_epics_spec.rb +8 -14
- data/spec/models/list_group_stories_spec.rb +8 -14
- data/spec/models/list_labels_spec.rb +8 -14
- data/spec/models/list_members_spec.rb +8 -14
- data/spec/models/max_search_results_exceeded_error_spec.rb +11 -17
- data/spec/models/member_info_spec.rb +8 -14
- data/spec/models/member_spec.rb +9 -15
- data/spec/models/milestone_spec.rb +8 -14
- data/spec/models/milestone_stats_spec.rb +8 -14
- data/spec/models/profile_spec.rb +8 -14
- data/spec/models/project_spec.rb +8 -14
- data/spec/models/project_stats_spec.rb +8 -14
- data/spec/models/pull_request_label_spec.rb +8 -14
- data/spec/models/pull_request_spec.rb +8 -14
- data/spec/models/repository_spec.rb +8 -14
- data/spec/models/search_results_spec.rb +8 -14
- data/spec/models/search_spec.rb +9 -15
- data/spec/models/search_stories_spec.rb +10 -16
- data/spec/models/story_comment_spec.rb +8 -14
- data/spec/models/story_contents_spec.rb +8 -14
- data/spec/models/story_contents_task_spec.rb +8 -14
- data/spec/models/story_history_change_adds_removes_int_spec.rb +8 -14
- data/spec/models/story_history_change_adds_removes_uuid_spec.rb +8 -14
- data/spec/models/story_history_change_old_new_bool_spec.rb +8 -14
- data/spec/models/story_history_change_old_new_int_spec.rb +8 -14
- data/spec/models/story_history_change_old_new_str_spec.rb +8 -14
- data/spec/models/story_history_change_old_new_uuid_spec.rb +8 -14
- data/spec/models/story_link_spec.rb +8 -14
- data/spec/models/story_reaction_spec.rb +8 -14
- data/spec/models/story_search_results_spec.rb +8 -14
- data/spec/models/story_slim_spec.rb +8 -14
- data/spec/models/story_spec.rb +8 -14
- data/spec/models/story_stats_spec.rb +8 -14
- data/spec/models/task_spec.rb +8 -14
- data/spec/models/threaded_comment_spec.rb +8 -14
- data/spec/models/typed_story_link_spec.rb +8 -14
- data/spec/models/unusable_entitlement_error_spec.rb +9 -15
- data/spec/models/update_category_spec.rb +8 -14
- data/spec/models/update_comment_spec.rb +8 -14
- data/spec/models/update_entity_template_spec.rb +8 -14
- data/spec/models/update_epic_spec.rb +9 -15
- data/spec/models/update_file_spec.rb +8 -14
- data/spec/models/update_group_spec.rb +9 -15
- data/spec/models/update_iteration_spec.rb +8 -14
- data/spec/models/update_label_spec.rb +8 -14
- data/spec/models/update_linked_file_spec.rb +9 -15
- data/spec/models/update_milestone_spec.rb +9 -15
- data/spec/models/update_project_spec.rb +8 -14
- data/spec/models/update_stories_spec.rb +10 -16
- data/spec/models/update_story_comment_spec.rb +8 -14
- data/spec/models/update_story_contents_spec.rb +8 -14
- data/spec/models/update_story_link_spec.rb +9 -15
- data/spec/models/update_story_spec.rb +10 -16
- data/spec/models/update_task_spec.rb +8 -14
- data/spec/models/uploaded_file_spec.rb +8 -14
- data/spec/models/workflow_spec.rb +8 -14
- data/spec/models/workflow_state_spec.rb +8 -14
- data/spec/spec_helper.rb +4 -3
- metadata +18 -30
- data/docs/V3FilesBody.md +0 -11
- data/lib/shortcut/client/ruby/version.rb +0 -9
- data/lib/shortcut/client/ruby.rb +0 -12
- data/lib/shortcut_client_ruby/models/v3_files_body.rb +0 -252
- data/shortcut-client-ruby.gemspec +0 -36
- data/spec/base_object_spec.rb +0 -109
- data/spec/models/v3_files_body_spec.rb +0 -64
@@ -3,18 +3,20 @@
|
|
3
3
|
|
4
4
|
#Shortcut API
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 3.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.2.1
|
7
10
|
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 3.0.35
|
10
11
|
=end
|
11
12
|
|
12
13
|
require 'date'
|
13
14
|
require 'json'
|
14
15
|
require 'logger'
|
15
16
|
require 'tempfile'
|
16
|
-
require '
|
17
|
-
require '
|
17
|
+
require 'time'
|
18
|
+
require 'faraday'
|
19
|
+
require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
18
20
|
|
19
21
|
module Shortcut
|
20
22
|
class ApiClient
|
@@ -30,7 +32,7 @@ module Shortcut
|
|
30
32
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
31
33
|
def initialize(config = Configuration.default)
|
32
34
|
@config = config
|
33
|
-
@user_agent = "
|
35
|
+
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
34
36
|
@default_headers = {
|
35
37
|
'Content-Type' => 'application/json',
|
36
38
|
'User-Agent' => @user_agent
|
@@ -46,26 +48,29 @@ module Shortcut
|
|
46
48
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
47
49
|
# the data deserialized from response body (could be nil), response status code and response headers.
|
48
50
|
def call_api(http_method, path, opts = {})
|
49
|
-
|
50
|
-
|
51
|
+
begin
|
52
|
+
response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
|
53
|
+
build_request(http_method, path, req, opts)
|
54
|
+
end
|
51
55
|
|
52
|
-
|
53
|
-
|
54
|
-
|
56
|
+
if config.debugging
|
57
|
+
config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
58
|
+
end
|
55
59
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
response.status_message
|
60
|
+
unless response.success?
|
61
|
+
if response.status == 0
|
62
|
+
# Errors from libcurl will be made visible here
|
63
|
+
fail ApiError.new(code: 0,
|
64
|
+
message: response.return_message)
|
65
|
+
else
|
66
|
+
fail ApiError.new(code: response.status,
|
67
|
+
response_headers: response.headers,
|
68
|
+
response_body: response.body),
|
69
|
+
response.reason_phrase
|
70
|
+
end
|
68
71
|
end
|
72
|
+
rescue Faraday::TimeoutError
|
73
|
+
fail ApiError.new('Connection timed out')
|
69
74
|
end
|
70
75
|
|
71
76
|
if opts[:return_type]
|
@@ -73,7 +78,7 @@ module Shortcut
|
|
73
78
|
else
|
74
79
|
data = nil
|
75
80
|
end
|
76
|
-
return data, response.
|
81
|
+
return data, response.status, response.headers
|
77
82
|
end
|
78
83
|
|
79
84
|
# Builds the HTTP request
|
@@ -84,9 +89,9 @@ module Shortcut
|
|
84
89
|
# @option opts [Hash] :query_params Query parameters
|
85
90
|
# @option opts [Hash] :form_params Query parameters
|
86
91
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
87
|
-
# @return [
|
88
|
-
def build_request(http_method, path, opts = {})
|
89
|
-
url = build_request_url(path)
|
92
|
+
# @return [Faraday::Request] A Faraday Request
|
93
|
+
def build_request(http_method, path, request, opts = {})
|
94
|
+
url = build_request_url(path, opts)
|
90
95
|
http_method = http_method.to_sym.downcase
|
91
96
|
|
92
97
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
@@ -95,35 +100,22 @@ module Shortcut
|
|
95
100
|
|
96
101
|
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
97
102
|
|
98
|
-
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
99
|
-
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
100
|
-
|
101
|
-
req_opts = {
|
102
|
-
:method => http_method,
|
103
|
-
:headers => header_params,
|
104
|
-
:params => query_params,
|
105
|
-
:params_encoding => @config.params_encoding,
|
106
|
-
:timeout => @config.timeout,
|
107
|
-
:ssl_verifypeer => @config.verify_ssl,
|
108
|
-
:ssl_verifyhost => _verify_ssl_host,
|
109
|
-
:sslcert => @config.cert_file,
|
110
|
-
:sslkey => @config.key_file,
|
111
|
-
:verbose => @config.debugging
|
112
|
-
}
|
113
|
-
|
114
|
-
# set custom cert, if provided
|
115
|
-
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
116
|
-
|
117
103
|
if [:post, :patch, :put, :delete].include?(http_method)
|
118
104
|
req_body = build_request_body(header_params, form_params, opts[:body])
|
119
|
-
|
120
|
-
|
121
|
-
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
105
|
+
if config.debugging
|
106
|
+
config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
122
107
|
end
|
123
108
|
end
|
109
|
+
request.headers = header_params
|
110
|
+
request.body = req_body
|
124
111
|
|
125
|
-
|
126
|
-
|
112
|
+
# Overload default options only if provided
|
113
|
+
request.options.params_encoder = config.params_encoder if config.params_encoder
|
114
|
+
request.options.timeout = config.timeout if config.timeout
|
115
|
+
|
116
|
+
request.url url
|
117
|
+
request.params = query_params
|
118
|
+
download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
|
127
119
|
request
|
128
120
|
end
|
129
121
|
|
@@ -135,13 +127,17 @@ module Shortcut
|
|
135
127
|
# @return [String] HTTP body data in the form of string
|
136
128
|
def build_request_body(header_params, form_params, body)
|
137
129
|
# http form
|
138
|
-
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
|
139
|
-
|
130
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
|
131
|
+
data = URI.encode_www_form(form_params)
|
132
|
+
elsif header_params['Content-Type'] == 'multipart/form-data'
|
140
133
|
data = {}
|
141
134
|
form_params.each do |key, value|
|
142
135
|
case value
|
143
|
-
when ::File, ::
|
144
|
-
#
|
136
|
+
when ::File, ::Tempfile
|
137
|
+
# TODO hardcode to application/octet-stream, need better way to detect content type
|
138
|
+
data[key] = Faraday::FilePart.new(value.path, 'application/octet-stream', value.path)
|
139
|
+
when ::Array, nil
|
140
|
+
# let Faraday handle Array and nil parameters
|
145
141
|
data[key] = value
|
146
142
|
else
|
147
143
|
data[key] = value.to_s
|
@@ -155,6 +151,59 @@ module Shortcut
|
|
155
151
|
data
|
156
152
|
end
|
157
153
|
|
154
|
+
def download_file(request)
|
155
|
+
@stream = []
|
156
|
+
|
157
|
+
# handle streaming Responses
|
158
|
+
request.options.on_data = Proc.new do |chunk, overall_received_bytes|
|
159
|
+
@stream << chunk
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def connection(opts)
|
164
|
+
opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular
|
165
|
+
end
|
166
|
+
|
167
|
+
def connection_multipart
|
168
|
+
@connection_multipart ||= build_connection do |conn|
|
169
|
+
conn.request :multipart
|
170
|
+
conn.request :url_encoded
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def connection_regular
|
175
|
+
@connection_regular ||= build_connection
|
176
|
+
end
|
177
|
+
|
178
|
+
def build_connection
|
179
|
+
Faraday.new(url: config.base_url, ssl: ssl_options) do |conn|
|
180
|
+
basic_auth(conn)
|
181
|
+
config.configure_middleware(conn)
|
182
|
+
yield(conn) if block_given?
|
183
|
+
conn.adapter(Faraday.default_adapter)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def ssl_options
|
188
|
+
{
|
189
|
+
ca_file: config.ssl_ca_file,
|
190
|
+
verify: config.ssl_verify,
|
191
|
+
verify_mode: config.ssl_verify_mode,
|
192
|
+
client_cert: config.ssl_client_cert,
|
193
|
+
client_key: config.ssl_client_key
|
194
|
+
}
|
195
|
+
end
|
196
|
+
|
197
|
+
def basic_auth(conn)
|
198
|
+
if config.username && config.password
|
199
|
+
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
200
|
+
conn.request(:authorization, :basic, config.username, config.password)
|
201
|
+
else
|
202
|
+
conn.request(:basic_auth, config.username, config.password)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
158
207
|
# Check if the given MIME is a JSON MIME.
|
159
208
|
# JSON MIME examples:
|
160
209
|
# application/json
|
@@ -176,7 +225,32 @@ module Shortcut
|
|
176
225
|
|
177
226
|
# handle file downloading - return the File instance processed in request callbacks
|
178
227
|
# note that response body is empty when the file is written in chunks in request on_body callback
|
179
|
-
|
228
|
+
if return_type == 'File'
|
229
|
+
if @config.return_binary_data == true
|
230
|
+
# return byte stream
|
231
|
+
encoding = body.encoding
|
232
|
+
return @stream.join.force_encoding(encoding)
|
233
|
+
else
|
234
|
+
# return file instead of binary data
|
235
|
+
content_disposition = response.headers['Content-Disposition']
|
236
|
+
if content_disposition && content_disposition =~ /filename=/i
|
237
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
238
|
+
prefix = sanitize_filename(filename)
|
239
|
+
else
|
240
|
+
prefix = 'download-'
|
241
|
+
end
|
242
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
243
|
+
encoding = body.encoding
|
244
|
+
@tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
245
|
+
@tempfile.write(@stream.join.force_encoding(encoding))
|
246
|
+
@tempfile.close
|
247
|
+
@config.logger.info "Temp file written to #{@tempfile.path}, please copy the file to a proper folder "\
|
248
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
249
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
250
|
+
"explicitly with `tempfile.delete`"
|
251
|
+
return @tempfile
|
252
|
+
end
|
253
|
+
end
|
180
254
|
|
181
255
|
return nil if body.nil? || body.empty?
|
182
256
|
|
@@ -191,7 +265,7 @@ module Shortcut
|
|
191
265
|
begin
|
192
266
|
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
193
267
|
rescue JSON::ParserError => e
|
194
|
-
if %w(String Date
|
268
|
+
if %w(String Date Time).include?(return_type)
|
195
269
|
data = body
|
196
270
|
else
|
197
271
|
raise e
|
@@ -216,9 +290,9 @@ module Shortcut
|
|
216
290
|
data.to_f
|
217
291
|
when 'Boolean'
|
218
292
|
data == true
|
219
|
-
when '
|
293
|
+
when 'Time'
|
220
294
|
# parse date time (expecting ISO 8601 format)
|
221
|
-
|
295
|
+
Time.parse data
|
222
296
|
when 'Date'
|
223
297
|
# parse date time (expecting ISO 8601 format)
|
224
298
|
Date.parse data
|
@@ -236,46 +310,9 @@ module Shortcut
|
|
236
310
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
237
311
|
end
|
238
312
|
else
|
239
|
-
# models
|
240
|
-
Shortcut.const_get(return_type)
|
241
|
-
|
242
|
-
end
|
243
|
-
|
244
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
245
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
246
|
-
# The response body is written to the file in chunks in order to handle files which
|
247
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
248
|
-
# process can use.
|
249
|
-
#
|
250
|
-
# @see Configuration#temp_folder_path
|
251
|
-
def download_file(request)
|
252
|
-
tempfile = nil
|
253
|
-
encoding = nil
|
254
|
-
request.on_headers do |response|
|
255
|
-
content_disposition = response.headers['Content-Disposition']
|
256
|
-
if content_disposition && content_disposition =~ /filename=/i
|
257
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
258
|
-
prefix = sanitize_filename(filename)
|
259
|
-
else
|
260
|
-
prefix = 'download-'
|
261
|
-
end
|
262
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
263
|
-
encoding = response.body.encoding
|
264
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
265
|
-
@tempfile = tempfile
|
266
|
-
end
|
267
|
-
request.on_body do |chunk|
|
268
|
-
chunk.force_encoding(encoding)
|
269
|
-
tempfile.write(chunk)
|
270
|
-
end
|
271
|
-
request.on_complete do |response|
|
272
|
-
if tempfile
|
273
|
-
tempfile.close
|
274
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
275
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
276
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
277
|
-
"explicitly with `tempfile.delete`"
|
278
|
-
end
|
313
|
+
# models (e.g. Pet) or oneOf
|
314
|
+
klass = Shortcut.const_get(return_type)
|
315
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
279
316
|
end
|
280
317
|
end
|
281
318
|
|
@@ -288,13 +325,13 @@ module Shortcut
|
|
288
325
|
filename.gsub(/.*[\/\\]/, '')
|
289
326
|
end
|
290
327
|
|
291
|
-
def build_request_url(path)
|
328
|
+
def build_request_url(path, opts = {})
|
292
329
|
# Add leading and trailing slashes to path
|
293
330
|
path = "/#{path}".gsub(/\/+/, '/')
|
294
|
-
@config.base_url + path
|
331
|
+
@config.base_url(opts[:operation]) + path
|
295
332
|
end
|
296
333
|
|
297
|
-
# Update
|
334
|
+
# Update header and query params based on authentication settings.
|
298
335
|
#
|
299
336
|
# @param [Hash] header_params Header parameters
|
300
337
|
# @param [Hash] query_params Query parameters
|
@@ -306,14 +343,14 @@ module Shortcut
|
|
306
343
|
case auth_setting[:in]
|
307
344
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
308
345
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
309
|
-
else fail ArgumentError, 'Authentication token must be in `query`
|
346
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
310
347
|
end
|
311
348
|
end
|
312
349
|
end
|
313
350
|
|
314
351
|
# Sets user agent in HTTP header
|
315
352
|
#
|
316
|
-
# @param [String] user_agent User agent (e.g.
|
353
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
317
354
|
def user_agent=(user_agent)
|
318
355
|
@user_agent = user_agent
|
319
356
|
@default_headers['User-Agent'] = @user_agent
|
@@ -333,8 +370,8 @@ module Shortcut
|
|
333
370
|
# @param [Array] content_types array for Content-Type
|
334
371
|
# @return [String] the Content-Type header (e.g. application/json)
|
335
372
|
def select_header_content_type(content_types)
|
336
|
-
#
|
337
|
-
return
|
373
|
+
# return nil by default
|
374
|
+
return if content_types.nil? || content_types.empty?
|
338
375
|
# use JSON when present, otherwise use the first one
|
339
376
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
340
377
|
json_content_type || content_types.first
|
@@ -3,10 +3,11 @@
|
|
3
3
|
|
4
4
|
#Shortcut API
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 3.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.2.1
|
7
10
|
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 3.0.35
|
10
11
|
=end
|
11
12
|
|
12
13
|
module Shortcut
|
@@ -52,6 +53,5 @@ module Shortcut
|
|
52
53
|
|
53
54
|
msg
|
54
55
|
end
|
55
|
-
|
56
56
|
end
|
57
57
|
end
|
@@ -3,10 +3,11 @@
|
|
3
3
|
|
4
4
|
#Shortcut API
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 3.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.2.1
|
7
10
|
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 3.0.35
|
10
11
|
=end
|
11
12
|
|
12
13
|
module Shortcut
|
@@ -20,6 +21,18 @@ module Shortcut
|
|
20
21
|
# Defines url base path
|
21
22
|
attr_accessor :base_path
|
22
23
|
|
24
|
+
# Define server configuration index
|
25
|
+
attr_accessor :server_index
|
26
|
+
|
27
|
+
# Define server operation configuration index
|
28
|
+
attr_accessor :server_operation_index
|
29
|
+
|
30
|
+
# Default server variables
|
31
|
+
attr_accessor :server_variables
|
32
|
+
|
33
|
+
# Default server operation variables
|
34
|
+
attr_accessor :server_operation_variables
|
35
|
+
|
23
36
|
# Defines API keys used with API Key authentications.
|
24
37
|
#
|
25
38
|
# @return [Hash] key: parameter name, value: parameter value (API key)
|
@@ -85,40 +98,40 @@ module Shortcut
|
|
85
98
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
86
99
|
#
|
87
100
|
# @return [true, false]
|
88
|
-
attr_accessor :
|
101
|
+
attr_accessor :ssl_verify
|
89
102
|
|
90
103
|
### TLS/SSL setting
|
91
|
-
#
|
92
|
-
# Default to true.
|
104
|
+
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
|
93
105
|
#
|
94
106
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
95
107
|
#
|
96
|
-
|
97
|
-
attr_accessor :verify_ssl_host
|
108
|
+
attr_accessor :ssl_verify_mode
|
98
109
|
|
99
110
|
### TLS/SSL setting
|
100
111
|
# Set this to customize the certificate file to verify the peer.
|
101
112
|
#
|
102
113
|
# @return [String] the path to the certificate file
|
103
|
-
|
104
|
-
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
105
|
-
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
106
|
-
attr_accessor :ssl_ca_cert
|
114
|
+
attr_accessor :ssl_ca_file
|
107
115
|
|
108
116
|
### TLS/SSL setting
|
109
117
|
# Client certificate file (for client certificate)
|
110
|
-
attr_accessor :
|
118
|
+
attr_accessor :ssl_client_cert
|
111
119
|
|
112
120
|
### TLS/SSL setting
|
113
121
|
# Client private key file (for client certificate)
|
114
|
-
attr_accessor :
|
122
|
+
attr_accessor :ssl_client_key
|
123
|
+
|
124
|
+
### Proxy setting
|
125
|
+
# HTTP Proxy settings
|
126
|
+
attr_accessor :proxy
|
115
127
|
|
116
|
-
# Set this to customize parameters
|
117
|
-
# Default to nil.
|
128
|
+
# Set this to customize parameters encoder of array parameter.
|
129
|
+
# Default to nil. Faraday uses NestedParamsEncoder when nil.
|
118
130
|
#
|
119
|
-
# @see The
|
120
|
-
# https://github.com/
|
121
|
-
attr_accessor :
|
131
|
+
# @see The params_encoder option of Faraday. Related source code:
|
132
|
+
# https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
|
133
|
+
attr_accessor :params_encoder
|
134
|
+
|
122
135
|
|
123
136
|
attr_accessor :inject_format
|
124
137
|
|
@@ -127,16 +140,24 @@ module Shortcut
|
|
127
140
|
def initialize
|
128
141
|
@scheme = 'https'
|
129
142
|
@host = 'api.app.shortcut.com'
|
130
|
-
@base_path = '
|
143
|
+
@base_path = ''
|
144
|
+
@server_index = 0
|
145
|
+
@server_operation_index = {}
|
146
|
+
@server_variables = {}
|
147
|
+
@server_operation_variables = {}
|
131
148
|
@api_key = {}
|
132
149
|
@api_key_prefix = {}
|
133
|
-
@timeout = 0
|
134
150
|
@client_side_validation = true
|
135
|
-
@
|
136
|
-
@
|
137
|
-
@
|
138
|
-
@
|
139
|
-
@
|
151
|
+
@ssl_verify = true
|
152
|
+
@ssl_verify_mode = nil
|
153
|
+
@ssl_ca_file = nil
|
154
|
+
@ssl_client_cert = nil
|
155
|
+
@ssl_client_key = nil
|
156
|
+
@middlewares = Hash.new { |h, k| h[k] = [] }
|
157
|
+
@timeout = 60
|
158
|
+
# return data as binary instead of file
|
159
|
+
@return_binary_data = false
|
160
|
+
@params_encoder = nil
|
140
161
|
@debugging = false
|
141
162
|
@inject_format = false
|
142
163
|
@force_ending_format = false
|
@@ -170,17 +191,23 @@ module Shortcut
|
|
170
191
|
@base_path = '' if @base_path == '/'
|
171
192
|
end
|
172
193
|
|
173
|
-
|
174
|
-
|
194
|
+
# Returns base URL for specified operation based on server settings
|
195
|
+
def base_url(operation = nil)
|
196
|
+
index = server_operation_index.fetch(operation, server_index)
|
197
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
198
|
+
|
199
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
175
200
|
end
|
176
201
|
|
177
202
|
# Gets API key (with prefix if set).
|
178
203
|
# @param [String] param_name the parameter name of API key auth
|
179
|
-
def api_key_with_prefix(param_name)
|
204
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
205
|
+
key = @api_key[param_name]
|
206
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
180
207
|
if @api_key_prefix[param_name]
|
181
|
-
"#{@api_key_prefix[param_name]} #{
|
208
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
182
209
|
else
|
183
|
-
|
210
|
+
key
|
184
211
|
end
|
185
212
|
end
|
186
213
|
|
@@ -197,9 +224,113 @@ module Shortcut
|
|
197
224
|
type: 'api_key',
|
198
225
|
in: 'header',
|
199
226
|
key: 'Shortcut-Token',
|
200
|
-
value: api_key_with_prefix('
|
227
|
+
value: api_key_with_prefix('api_token')
|
201
228
|
},
|
202
229
|
}
|
203
230
|
end
|
231
|
+
|
232
|
+
# Returns an array of Server setting
|
233
|
+
def server_settings
|
234
|
+
[
|
235
|
+
{
|
236
|
+
url: "https://api.app.shortcut.com",
|
237
|
+
description: "No description provided",
|
238
|
+
}
|
239
|
+
]
|
240
|
+
end
|
241
|
+
|
242
|
+
def operation_server_settings
|
243
|
+
{
|
244
|
+
}
|
245
|
+
end
|
246
|
+
|
247
|
+
# Returns URL based on server settings
|
248
|
+
#
|
249
|
+
# @param index array index of the server settings
|
250
|
+
# @param variables hash of variable and the corresponding value
|
251
|
+
def server_url(index, variables = {}, servers = nil)
|
252
|
+
servers = server_settings if servers == nil
|
253
|
+
|
254
|
+
# check array index out of bound
|
255
|
+
if (index < 0 || index >= servers.size)
|
256
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
257
|
+
end
|
258
|
+
|
259
|
+
server = servers[index]
|
260
|
+
url = server[:url]
|
261
|
+
|
262
|
+
return url unless server.key? :variables
|
263
|
+
|
264
|
+
# go through variable and assign a value
|
265
|
+
server[:variables].each do |name, variable|
|
266
|
+
if variables.key?(name)
|
267
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
268
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
269
|
+
else
|
270
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
271
|
+
end
|
272
|
+
else
|
273
|
+
# use default value
|
274
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
url
|
279
|
+
end
|
280
|
+
|
281
|
+
# Adds middleware to the stack
|
282
|
+
def use(*middleware)
|
283
|
+
set_faraday_middleware(:use, *middleware)
|
284
|
+
end
|
285
|
+
|
286
|
+
# Adds request middleware to the stack
|
287
|
+
def request(*middleware)
|
288
|
+
set_faraday_middleware(:request, *middleware)
|
289
|
+
end
|
290
|
+
|
291
|
+
# Adds response middleware to the stack
|
292
|
+
def response(*middleware)
|
293
|
+
set_faraday_middleware(:response, *middleware)
|
294
|
+
end
|
295
|
+
|
296
|
+
# Adds Faraday middleware setting information to the stack
|
297
|
+
#
|
298
|
+
# @example Use the `set_faraday_middleware` method to set middleware information
|
299
|
+
# config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
|
300
|
+
# config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
|
301
|
+
# config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
|
302
|
+
# config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
|
303
|
+
# config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
|
304
|
+
# config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
|
305
|
+
#
|
306
|
+
# @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
|
307
|
+
def set_faraday_middleware(operation, key, *args, &block)
|
308
|
+
unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
|
309
|
+
fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
|
310
|
+
" :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
|
311
|
+
end
|
312
|
+
|
313
|
+
@middlewares[operation] << [key, args, block]
|
314
|
+
end
|
315
|
+
ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
|
316
|
+
|
317
|
+
# Set up middleware on the connection
|
318
|
+
def configure_middleware(connection)
|
319
|
+
return if @middlewares.empty?
|
320
|
+
|
321
|
+
[:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
|
322
|
+
next unless @middlewares.key?(operation)
|
323
|
+
|
324
|
+
@middlewares[operation].each do |key, args, block|
|
325
|
+
connection.builder.send(operation, key, *args, &block)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
if @middlewares.key?(:delete)
|
330
|
+
@middlewares[:delete].each do |key, _args, _block|
|
331
|
+
connection.builder.delete(key)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
204
335
|
end
|
205
336
|
end
|