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.
Files changed (452) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +74 -0
  3. data/README.md +31 -1986
  4. data/Rakefile +2 -0
  5. data/bin/update.rb +8 -4
  6. data/config.json +2 -1
  7. data/docs/BasicWorkspaceInfo.md +16 -4
  8. data/docs/Branch.md +34 -13
  9. data/docs/Category.md +30 -11
  10. data/docs/Commit.md +38 -15
  11. data/docs/CreateCategory.md +20 -6
  12. data/docs/CreateCategoryParams.md +18 -5
  13. data/docs/CreateCommentComment.md +22 -7
  14. data/docs/CreateEntityTemplate.md +18 -5
  15. data/docs/CreateEpic.md +46 -19
  16. data/docs/CreateEpicComment.md +22 -7
  17. data/docs/CreateGroup.md +28 -10
  18. data/docs/CreateIteration.md +26 -9
  19. data/docs/CreateLabelParams.md +20 -6
  20. data/docs/CreateLinkedFile.md +30 -11
  21. data/docs/CreateMilestone.md +24 -8
  22. data/docs/CreateOrDeleteStoryReaction.md +14 -3
  23. data/docs/CreateProject.md +34 -13
  24. data/docs/CreateStories.md +14 -3
  25. data/docs/CreateStoryComment.md +22 -7
  26. data/docs/CreateStoryCommentParams.md +22 -7
  27. data/docs/CreateStoryContents.md +54 -23
  28. data/docs/CreateStoryLink.md +18 -5
  29. data/docs/CreateStoryLinkParams.md +18 -5
  30. data/docs/CreateStoryParams.md +66 -29
  31. data/docs/CreateTask.md +24 -8
  32. data/docs/CreateTaskParams.md +24 -8
  33. data/docs/DefaultApi.md +3569 -1641
  34. data/docs/DeleteStories.md +14 -3
  35. data/docs/EntityTemplate.md +28 -10
  36. data/docs/EntityTemplateTask.md +20 -6
  37. data/docs/Epic.md +88 -40
  38. data/docs/EpicSearchResults.md +20 -6
  39. data/docs/EpicSlim.md +86 -39
  40. data/docs/EpicState.md +30 -11
  41. data/docs/EpicStats.md +38 -15
  42. data/docs/EpicWorkflow.md +24 -8
  43. data/docs/GetEpicStories.md +14 -3
  44. data/docs/GetExternalLinkStoriesParams.md +14 -3
  45. data/docs/GetIterationStories.md +14 -3
  46. data/docs/GetLabelStories.md +14 -3
  47. data/docs/GetMember.md +14 -3
  48. data/docs/GetProjectStories.md +14 -3
  49. data/docs/Group.md +44 -18
  50. data/docs/History.md +30 -11
  51. data/docs/HistoryActionBranchCreate.md +22 -7
  52. data/docs/HistoryActionBranchMerge.md +22 -7
  53. data/docs/HistoryActionBranchPush.md +22 -7
  54. data/docs/HistoryActionLabelCreate.md +22 -7
  55. data/docs/HistoryActionLabelDelete.md +20 -6
  56. data/docs/HistoryActionLabelUpdate.md +18 -5
  57. data/docs/HistoryActionProjectUpdate.md +22 -7
  58. data/docs/HistoryActionPullRequest.md +24 -8
  59. data/docs/HistoryActionStoryCommentCreate.md +24 -8
  60. data/docs/HistoryActionStoryCreate.md +60 -26
  61. data/docs/HistoryActionStoryDelete.md +22 -7
  62. data/docs/HistoryActionStoryLinkCreate.md +24 -8
  63. data/docs/HistoryActionStoryLinkDelete.md +24 -8
  64. data/docs/HistoryActionStoryLinkUpdate.md +26 -9
  65. data/docs/HistoryActionStoryUpdate.md +26 -9
  66. data/docs/HistoryActionTaskCreate.md +30 -11
  67. data/docs/HistoryActionTaskDelete.md +20 -6
  68. data/docs/HistoryActionTaskUpdate.md +26 -9
  69. data/docs/HistoryChangesStory.md +60 -26
  70. data/docs/HistoryChangesStoryLink.md +18 -5
  71. data/docs/HistoryChangesTask.md +20 -6
  72. data/docs/HistoryReferenceBranch.md +20 -6
  73. data/docs/HistoryReferenceCommit.md +20 -6
  74. data/docs/HistoryReferenceEpic.md +20 -6
  75. data/docs/HistoryReferenceGeneral.md +18 -5
  76. data/docs/HistoryReferenceGroup.md +18 -5
  77. data/docs/HistoryReferenceIteration.md +20 -6
  78. data/docs/HistoryReferenceLabel.md +20 -6
  79. data/docs/HistoryReferenceProject.md +20 -6
  80. data/docs/HistoryReferenceStory.md +22 -7
  81. data/docs/HistoryReferenceStoryTask.md +18 -5
  82. data/docs/HistoryReferenceWorkflowState.md +20 -6
  83. data/docs/Icon.md +22 -7
  84. data/docs/Identity.md +18 -5
  85. data/docs/Iteration.md +48 -20
  86. data/docs/IterationSlim.md +46 -19
  87. data/docs/IterationStats.md +34 -13
  88. data/docs/Label.md +34 -13
  89. data/docs/LabelSlim.md +32 -12
  90. data/docs/LabelStats.md +42 -17
  91. data/docs/LinkedFile.md +44 -18
  92. data/docs/ListEpics.md +14 -3
  93. data/docs/ListGroupStories.md +16 -4
  94. data/docs/ListLabels.md +14 -3
  95. data/docs/ListMembers.md +14 -3
  96. data/docs/MaxSearchResultsExceededError.md +18 -5
  97. data/docs/Member.md +34 -13
  98. data/docs/MemberInfo.md +20 -6
  99. data/docs/Milestone.md +46 -19
  100. data/docs/MilestoneStats.md +18 -5
  101. data/docs/Profile.md +30 -11
  102. data/docs/Project.md +50 -21
  103. data/docs/ProjectStats.md +18 -5
  104. data/docs/PullRequest.md +56 -24
  105. data/docs/PullRequestLabel.md +22 -7
  106. data/docs/Repository.md +30 -11
  107. data/docs/Search.md +20 -6
  108. data/docs/SearchResults.md +16 -4
  109. data/docs/SearchStories.md +68 -30
  110. data/docs/Story.md +112 -52
  111. data/docs/StoryComment.md +40 -16
  112. data/docs/StoryContents.md +50 -21
  113. data/docs/StoryContentsTask.md +22 -7
  114. data/docs/StoryHistoryChangeAddsRemovesInt.md +16 -4
  115. data/docs/StoryHistoryChangeAddsRemovesUuid.md +16 -4
  116. data/docs/StoryHistoryChangeOldNewBool.md +16 -4
  117. data/docs/StoryHistoryChangeOldNewInt.md +16 -4
  118. data/docs/StoryHistoryChangeOldNewStr.md +16 -4
  119. data/docs/StoryHistoryChangeOldNewUuid.md +16 -4
  120. data/docs/StoryLink.md +28 -10
  121. data/docs/StoryReaction.md +16 -4
  122. data/docs/StorySearchResults.md +20 -6
  123. data/docs/StorySlim.md +108 -50
  124. data/docs/StoryStats.md +14 -3
  125. data/docs/Task.md +40 -16
  126. data/docs/ThreadedComment.md +38 -15
  127. data/docs/TypedStoryLink.md +30 -11
  128. data/docs/UnusableEntitlementError.md +18 -5
  129. data/docs/UpdateCategory.md +18 -5
  130. data/docs/UpdateComment.md +14 -3
  131. data/docs/UpdateEntityTemplate.md +16 -4
  132. data/docs/UpdateEpic.md +46 -19
  133. data/docs/UpdateFile.md +24 -8
  134. data/docs/UpdateGroup.md +30 -11
  135. data/docs/UpdateIteration.md +26 -9
  136. data/docs/UpdateLabel.md +20 -6
  137. data/docs/UpdateLinkedFile.md +28 -10
  138. data/docs/UpdateMilestone.md +28 -10
  139. data/docs/UpdateProject.md +30 -11
  140. data/docs/UpdateStories.md +54 -23
  141. data/docs/UpdateStory.md +64 -28
  142. data/docs/UpdateStoryComment.md +14 -3
  143. data/docs/UpdateStoryContents.md +54 -23
  144. data/docs/UpdateStoryLink.md +18 -5
  145. data/docs/UpdateTask.md +22 -7
  146. data/docs/UploadedFile.md +46 -19
  147. data/docs/Workflow.md +34 -13
  148. data/docs/WorkflowState.md +36 -14
  149. data/git_push.sh +11 -9
  150. data/lib/shortcut_client_ruby/api/default_api.rb +2119 -1248
  151. data/lib/shortcut_client_ruby/api_client.rb +143 -106
  152. data/lib/shortcut_client_ruby/api_error.rb +4 -4
  153. data/lib/shortcut_client_ruby/configuration.rb +163 -32
  154. data/lib/shortcut_client_ruby/models/basic_workspace_info.rb +26 -13
  155. data/lib/shortcut_client_ruby/models/branch.rb +35 -42
  156. data/lib/shortcut_client_ruby/models/category.rb +57 -28
  157. data/lib/shortcut_client_ruby/models/commit.rb +37 -44
  158. data/lib/shortcut_client_ruby/models/create_category.rb +90 -17
  159. data/lib/shortcut_client_ruby/models/create_category_params.rb +87 -14
  160. data/lib/shortcut_client_ruby/models/create_comment_comment.rb +57 -16
  161. data/lib/shortcut_client_ruby/models/create_entity_template.rb +46 -14
  162. data/lib/shortcut_client_ruby/models/create_epic.rb +86 -30
  163. data/lib/shortcut_client_ruby/models/create_epic_comment.rb +57 -16
  164. data/lib/shortcut_client_ruby/models/create_group.rb +104 -21
  165. data/lib/shortcut_client_ruby/models/create_iteration.rb +103 -18
  166. data/lib/shortcut_client_ruby/models/create_label_params.rb +97 -15
  167. data/lib/shortcut_client_ruby/models/create_linked_file.rb +110 -22
  168. data/lib/shortcut_client_ruby/models/create_milestone.rb +75 -19
  169. data/lib/shortcut_client_ruby/models/create_or_delete_story_reaction.rb +25 -12
  170. data/lib/shortcut_client_ruby/models/create_project.rb +104 -22
  171. data/lib/shortcut_client_ruby/models/create_stories.rb +25 -12
  172. data/lib/shortcut_client_ruby/models/create_story_comment.rb +48 -16
  173. data/lib/shortcut_client_ruby/models/create_story_comment_params.rb +48 -16
  174. data/lib/shortcut_client_ruby/models/create_story_contents.rb +57 -32
  175. data/lib/shortcut_client_ruby/models/create_story_link.rb +29 -16
  176. data/lib/shortcut_client_ruby/models/create_story_link_params.rb +29 -16
  177. data/lib/shortcut_client_ruby/models/create_story_params.rb +120 -40
  178. data/lib/shortcut_client_ruby/models/create_task.rb +30 -17
  179. data/lib/shortcut_client_ruby/models/create_task_params.rb +30 -17
  180. data/lib/shortcut_client_ruby/models/delete_stories.rb +35 -12
  181. data/lib/shortcut_client_ruby/models/entity_template.rb +32 -19
  182. data/lib/shortcut_client_ruby/models/entity_template_task.rb +28 -15
  183. data/lib/shortcut_client_ruby/models/epic.rb +62 -124
  184. data/lib/shortcut_client_ruby/models/epic_search_results.rb +28 -20
  185. data/lib/shortcut_client_ruby/models/epic_slim.rb +61 -123
  186. data/lib/shortcut_client_ruby/models/epic_state.rb +59 -20
  187. data/lib/shortcut_client_ruby/models/epic_stats.rb +37 -29
  188. data/lib/shortcut_client_ruby/models/epic_workflow.rb +30 -17
  189. data/lib/shortcut_client_ruby/models/get_epic_stories.rb +25 -12
  190. data/lib/shortcut_client_ruby/models/get_external_link_stories_params.rb +55 -12
  191. data/lib/shortcut_client_ruby/models/get_iteration_stories.rb +25 -12
  192. data/lib/shortcut_client_ruby/models/get_label_stories.rb +25 -12
  193. data/lib/shortcut_client_ruby/models/get_member.rb +25 -12
  194. data/lib/shortcut_client_ruby/models/get_project_stories.rb +25 -12
  195. data/lib/shortcut_client_ruby/models/group.rb +96 -37
  196. data/lib/shortcut_client_ruby/models/history.rb +35 -22
  197. data/lib/shortcut_client_ruby/models/history_action_branch_create.rb +31 -18
  198. data/lib/shortcut_client_ruby/models/history_action_branch_merge.rb +31 -18
  199. data/lib/shortcut_client_ruby/models/history_action_branch_push.rb +31 -18
  200. data/lib/shortcut_client_ruby/models/history_action_label_create.rb +61 -18
  201. data/lib/shortcut_client_ruby/models/history_action_label_delete.rb +30 -17
  202. data/lib/shortcut_client_ruby/models/history_action_label_update.rb +29 -16
  203. data/lib/shortcut_client_ruby/models/history_action_project_update.rb +61 -18
  204. data/lib/shortcut_client_ruby/models/history_action_pull_request.rb +62 -19
  205. data/lib/shortcut_client_ruby/models/history_action_story_comment_create.rb +62 -19
  206. data/lib/shortcut_client_ruby/models/history_action_story_create.rb +82 -39
  207. data/lib/shortcut_client_ruby/models/history_action_story_delete.rb +33 -20
  208. data/lib/shortcut_client_ruby/models/history_action_story_link_create.rb +34 -21
  209. data/lib/shortcut_client_ruby/models/history_action_story_link_delete.rb +34 -31
  210. data/lib/shortcut_client_ruby/models/history_action_story_link_update.rb +35 -22
  211. data/lib/shortcut_client_ruby/models/history_action_story_update.rb +65 -22
  212. data/lib/shortcut_client_ruby/models/history_action_task_create.rb +35 -22
  213. data/lib/shortcut_client_ruby/models/history_action_task_delete.rb +30 -17
  214. data/lib/shortcut_client_ruby/models/history_action_task_update.rb +33 -20
  215. data/lib/shortcut_client_ruby/models/history_changes_story.rb +48 -35
  216. data/lib/shortcut_client_ruby/models/history_changes_story_link.rb +27 -14
  217. data/lib/shortcut_client_ruby/models/history_changes_task.rb +28 -15
  218. data/lib/shortcut_client_ruby/models/history_reference_branch.rb +58 -15
  219. data/lib/shortcut_client_ruby/models/history_reference_commit.rb +58 -15
  220. data/lib/shortcut_client_ruby/models/history_reference_epic.rb +58 -15
  221. data/lib/shortcut_client_ruby/models/history_reference_general.rb +27 -14
  222. data/lib/shortcut_client_ruby/models/history_reference_group.rb +27 -14
  223. data/lib/shortcut_client_ruby/models/history_reference_iteration.rb +58 -15
  224. data/lib/shortcut_client_ruby/models/history_reference_label.rb +58 -15
  225. data/lib/shortcut_client_ruby/models/history_reference_project.rb +58 -15
  226. data/lib/shortcut_client_ruby/models/history_reference_story.rb +61 -18
  227. data/lib/shortcut_client_ruby/models/history_reference_story_task.rb +27 -14
  228. data/lib/shortcut_client_ruby/models/history_reference_workflow_state.rb +30 -17
  229. data/lib/shortcut_client_ruby/models/icon.rb +29 -16
  230. data/lib/shortcut_client_ruby/models/identity.rb +27 -24
  231. data/lib/shortcut_client_ruby/models/iteration.rb +42 -29
  232. data/lib/shortcut_client_ruby/models/iteration_slim.rb +41 -28
  233. data/lib/shortcut_client_ruby/models/iteration_stats.rb +35 -22
  234. data/lib/shortcut_client_ruby/models/label.rb +59 -45
  235. data/lib/shortcut_client_ruby/models/label_slim.rb +58 -44
  236. data/lib/shortcut_client_ruby/models/label_stats.rb +39 -26
  237. data/lib/shortcut_client_ruby/models/linked_file.rb +40 -47
  238. data/lib/shortcut_client_ruby/models/list_epics.rb +25 -12
  239. data/lib/shortcut_client_ruby/models/list_group_stories.rb +26 -13
  240. data/lib/shortcut_client_ruby/models/list_labels.rb +25 -12
  241. data/lib/shortcut_client_ruby/models/list_members.rb +25 -12
  242. data/lib/shortcut_client_ruby/models/max_search_results_exceeded_error.rb +31 -18
  243. data/lib/shortcut_client_ruby/models/member.rb +37 -34
  244. data/lib/shortcut_client_ruby/models/member_info.rb +28 -15
  245. data/lib/shortcut_client_ruby/models/milestone.rb +41 -48
  246. data/lib/shortcut_client_ruby/models/milestone_stats.rb +27 -14
  247. data/lib/shortcut_client_ruby/models/profile.rb +33 -35
  248. data/lib/shortcut_client_ruby/models/project.rb +67 -58
  249. data/lib/shortcut_client_ruby/models/project_stats.rb +27 -14
  250. data/lib/shortcut_client_ruby/models/pull_request.rb +46 -43
  251. data/lib/shortcut_client_ruby/models/pull_request_label.rb +59 -16
  252. data/lib/shortcut_client_ruby/models/repository.rb +33 -55
  253. data/lib/shortcut_client_ruby/models/search.rb +49 -17
  254. data/lib/shortcut_client_ruby/models/search_results.rb +26 -13
  255. data/lib/shortcut_client_ruby/models/search_stories.rb +105 -41
  256. data/lib/shortcut_client_ruby/models/story.rb +74 -131
  257. data/lib/shortcut_client_ruby/models/story_comment.rb +38 -40
  258. data/lib/shortcut_client_ruby/models/story_contents.rb +43 -30
  259. data/lib/shortcut_client_ruby/models/story_contents_task.rb +29 -16
  260. data/lib/shortcut_client_ruby/models/story_history_change_adds_removes_int.rb +26 -13
  261. data/lib/shortcut_client_ruby/models/story_history_change_adds_removes_uuid.rb +26 -13
  262. data/lib/shortcut_client_ruby/models/story_history_change_old_new_bool.rb +26 -13
  263. data/lib/shortcut_client_ruby/models/story_history_change_old_new_int.rb +26 -13
  264. data/lib/shortcut_client_ruby/models/story_history_change_old_new_str.rb +26 -13
  265. data/lib/shortcut_client_ruby/models/story_history_change_old_new_uuid.rb +26 -13
  266. data/lib/shortcut_client_ruby/models/story_link.rb +32 -19
  267. data/lib/shortcut_client_ruby/models/story_reaction.rb +26 -13
  268. data/lib/shortcut_client_ruby/models/story_search_results.rb +28 -20
  269. data/lib/shortcut_client_ruby/models/story_slim.rb +72 -129
  270. data/lib/shortcut_client_ruby/models/story_stats.rb +25 -12
  271. data/lib/shortcut_client_ruby/models/task.rb +38 -40
  272. data/lib/shortcut_client_ruby/models/threaded_comment.rb +37 -29
  273. data/lib/shortcut_client_ruby/models/typed_story_link.rb +33 -20
  274. data/lib/shortcut_client_ruby/models/unusable_entitlement_error.rb +85 -16
  275. data/lib/shortcut_client_ruby/models/update_category.rb +68 -14
  276. data/lib/shortcut_client_ruby/models/update_comment.rb +25 -12
  277. data/lib/shortcut_client_ruby/models/update_entity_template.rb +41 -13
  278. data/lib/shortcut_client_ruby/models/update_epic.rb +82 -30
  279. data/lib/shortcut_client_ruby/models/update_file.rb +54 -17
  280. data/lib/shortcut_client_ruby/models/update_group.rb +97 -22
  281. data/lib/shortcut_client_ruby/models/update_iteration.rb +91 -18
  282. data/lib/shortcut_client_ruby/models/update_label.rb +78 -15
  283. data/lib/shortcut_client_ruby/models/update_linked_file.rb +101 -21
  284. data/lib/shortcut_client_ruby/models/update_milestone.rb +73 -21
  285. data/lib/shortcut_client_ruby/models/update_project.rb +98 -20
  286. data/lib/shortcut_client_ruby/models/update_stories.rb +83 -36
  287. data/lib/shortcut_client_ruby/models/update_story.rb +135 -41
  288. data/lib/shortcut_client_ruby/models/update_story_comment.rb +44 -12
  289. data/lib/shortcut_client_ruby/models/update_story_contents.rb +57 -32
  290. data/lib/shortcut_client_ruby/models/update_story_link.rb +29 -16
  291. data/lib/shortcut_client_ruby/models/update_task.rb +29 -16
  292. data/lib/shortcut_client_ruby/models/uploaded_file.rb +41 -53
  293. data/lib/shortcut_client_ruby/models/workflow.rb +35 -22
  294. data/lib/shortcut_client_ruby/models/workflow_state.rb +60 -26
  295. data/lib/shortcut_client_ruby/version.rb +5 -4
  296. data/lib/shortcut_client_ruby.rb +4 -4
  297. data/openapi-generator-cli.jar +0 -0
  298. data/shortcut_client_ruby-0.0.4.gem +0 -0
  299. data/shortcut_client_ruby.gemspec +7 -6
  300. data/spec/api/default_api_spec.rb +64 -63
  301. data/spec/api_client_spec.rb +7 -44
  302. data/spec/configuration_spec.rb +7 -6
  303. data/spec/models/basic_workspace_info_spec.rb +8 -14
  304. data/spec/models/branch_spec.rb +8 -14
  305. data/spec/models/category_spec.rb +8 -14
  306. data/spec/models/commit_spec.rb +8 -14
  307. data/spec/models/create_category_params_spec.rb +8 -14
  308. data/spec/models/create_category_spec.rb +9 -15
  309. data/spec/models/create_comment_comment_spec.rb +8 -14
  310. data/spec/models/create_entity_template_spec.rb +8 -14
  311. data/spec/models/create_epic_comment_spec.rb +8 -14
  312. data/spec/models/create_epic_spec.rb +9 -15
  313. data/spec/models/create_group_spec.rb +9 -15
  314. data/spec/models/create_iteration_spec.rb +8 -14
  315. data/spec/models/create_label_params_spec.rb +8 -14
  316. data/spec/models/create_linked_file_spec.rb +9 -15
  317. data/spec/models/create_milestone_spec.rb +9 -15
  318. data/spec/models/create_or_delete_story_reaction_spec.rb +8 -14
  319. data/spec/models/create_project_spec.rb +8 -14
  320. data/spec/models/create_stories_spec.rb +8 -14
  321. data/spec/models/create_story_comment_params_spec.rb +8 -14
  322. data/spec/models/create_story_comment_spec.rb +8 -14
  323. data/spec/models/create_story_contents_spec.rb +8 -14
  324. data/spec/models/create_story_link_params_spec.rb +9 -15
  325. data/spec/models/create_story_link_spec.rb +9 -15
  326. data/spec/models/create_story_params_spec.rb +9 -15
  327. data/spec/models/create_task_params_spec.rb +8 -14
  328. data/spec/models/create_task_spec.rb +8 -14
  329. data/spec/models/delete_stories_spec.rb +8 -14
  330. data/spec/models/entity_template_spec.rb +8 -14
  331. data/spec/models/entity_template_task_spec.rb +8 -14
  332. data/spec/models/epic_search_results_spec.rb +8 -14
  333. data/spec/models/epic_slim_spec.rb +8 -14
  334. data/spec/models/epic_spec.rb +8 -14
  335. data/spec/models/epic_state_spec.rb +8 -14
  336. data/spec/models/epic_stats_spec.rb +8 -14
  337. data/spec/models/epic_workflow_spec.rb +8 -14
  338. data/spec/models/get_epic_stories_spec.rb +8 -14
  339. data/spec/models/get_external_link_stories_params_spec.rb +8 -14
  340. data/spec/models/get_iteration_stories_spec.rb +8 -14
  341. data/spec/models/get_label_stories_spec.rb +8 -14
  342. data/spec/models/get_member_spec.rb +8 -14
  343. data/spec/models/get_project_stories_spec.rb +8 -14
  344. data/spec/models/group_spec.rb +9 -15
  345. data/spec/models/history_action_branch_create_spec.rb +9 -15
  346. data/spec/models/history_action_branch_merge_spec.rb +9 -15
  347. data/spec/models/history_action_branch_push_spec.rb +9 -15
  348. data/spec/models/history_action_label_create_spec.rb +9 -15
  349. data/spec/models/history_action_label_delete_spec.rb +9 -15
  350. data/spec/models/history_action_label_update_spec.rb +9 -15
  351. data/spec/models/history_action_project_update_spec.rb +9 -15
  352. data/spec/models/history_action_pull_request_spec.rb +9 -15
  353. data/spec/models/history_action_story_comment_create_spec.rb +9 -15
  354. data/spec/models/history_action_story_create_spec.rb +10 -16
  355. data/spec/models/history_action_story_delete_spec.rb +10 -16
  356. data/spec/models/history_action_story_link_create_spec.rb +10 -16
  357. data/spec/models/history_action_story_link_delete_spec.rb +10 -16
  358. data/spec/models/history_action_story_link_update_spec.rb +10 -16
  359. data/spec/models/history_action_story_update_spec.rb +10 -16
  360. data/spec/models/history_action_task_create_spec.rb +9 -15
  361. data/spec/models/history_action_task_delete_spec.rb +9 -15
  362. data/spec/models/history_action_task_update_spec.rb +9 -15
  363. data/spec/models/history_changes_story_link_spec.rb +8 -14
  364. data/spec/models/history_changes_story_spec.rb +8 -14
  365. data/spec/models/history_changes_task_spec.rb +8 -14
  366. data/spec/models/history_reference_branch_spec.rb +8 -14
  367. data/spec/models/history_reference_commit_spec.rb +8 -14
  368. data/spec/models/history_reference_epic_spec.rb +8 -14
  369. data/spec/models/history_reference_general_spec.rb +8 -14
  370. data/spec/models/history_reference_group_spec.rb +8 -14
  371. data/spec/models/history_reference_iteration_spec.rb +8 -14
  372. data/spec/models/history_reference_label_spec.rb +8 -14
  373. data/spec/models/history_reference_project_spec.rb +8 -14
  374. data/spec/models/history_reference_story_spec.rb +9 -15
  375. data/spec/models/history_reference_story_task_spec.rb +8 -14
  376. data/spec/models/history_reference_workflow_state_spec.rb +9 -15
  377. data/spec/models/history_spec.rb +9 -15
  378. data/spec/models/icon_spec.rb +8 -14
  379. data/spec/models/identity_spec.rb +8 -14
  380. data/spec/models/iteration_slim_spec.rb +8 -14
  381. data/spec/models/iteration_spec.rb +8 -14
  382. data/spec/models/iteration_stats_spec.rb +8 -14
  383. data/spec/models/label_slim_spec.rb +8 -14
  384. data/spec/models/label_spec.rb +8 -14
  385. data/spec/models/label_stats_spec.rb +8 -14
  386. data/spec/models/linked_file_spec.rb +8 -14
  387. data/spec/models/list_epics_spec.rb +8 -14
  388. data/spec/models/list_group_stories_spec.rb +8 -14
  389. data/spec/models/list_labels_spec.rb +8 -14
  390. data/spec/models/list_members_spec.rb +8 -14
  391. data/spec/models/max_search_results_exceeded_error_spec.rb +11 -17
  392. data/spec/models/member_info_spec.rb +8 -14
  393. data/spec/models/member_spec.rb +9 -15
  394. data/spec/models/milestone_spec.rb +8 -14
  395. data/spec/models/milestone_stats_spec.rb +8 -14
  396. data/spec/models/profile_spec.rb +8 -14
  397. data/spec/models/project_spec.rb +8 -14
  398. data/spec/models/project_stats_spec.rb +8 -14
  399. data/spec/models/pull_request_label_spec.rb +8 -14
  400. data/spec/models/pull_request_spec.rb +8 -14
  401. data/spec/models/repository_spec.rb +8 -14
  402. data/spec/models/search_results_spec.rb +8 -14
  403. data/spec/models/search_spec.rb +9 -15
  404. data/spec/models/search_stories_spec.rb +10 -16
  405. data/spec/models/story_comment_spec.rb +8 -14
  406. data/spec/models/story_contents_spec.rb +8 -14
  407. data/spec/models/story_contents_task_spec.rb +8 -14
  408. data/spec/models/story_history_change_adds_removes_int_spec.rb +8 -14
  409. data/spec/models/story_history_change_adds_removes_uuid_spec.rb +8 -14
  410. data/spec/models/story_history_change_old_new_bool_spec.rb +8 -14
  411. data/spec/models/story_history_change_old_new_int_spec.rb +8 -14
  412. data/spec/models/story_history_change_old_new_str_spec.rb +8 -14
  413. data/spec/models/story_history_change_old_new_uuid_spec.rb +8 -14
  414. data/spec/models/story_link_spec.rb +8 -14
  415. data/spec/models/story_reaction_spec.rb +8 -14
  416. data/spec/models/story_search_results_spec.rb +8 -14
  417. data/spec/models/story_slim_spec.rb +8 -14
  418. data/spec/models/story_spec.rb +8 -14
  419. data/spec/models/story_stats_spec.rb +8 -14
  420. data/spec/models/task_spec.rb +8 -14
  421. data/spec/models/threaded_comment_spec.rb +8 -14
  422. data/spec/models/typed_story_link_spec.rb +8 -14
  423. data/spec/models/unusable_entitlement_error_spec.rb +9 -15
  424. data/spec/models/update_category_spec.rb +8 -14
  425. data/spec/models/update_comment_spec.rb +8 -14
  426. data/spec/models/update_entity_template_spec.rb +8 -14
  427. data/spec/models/update_epic_spec.rb +9 -15
  428. data/spec/models/update_file_spec.rb +8 -14
  429. data/spec/models/update_group_spec.rb +9 -15
  430. data/spec/models/update_iteration_spec.rb +8 -14
  431. data/spec/models/update_label_spec.rb +8 -14
  432. data/spec/models/update_linked_file_spec.rb +9 -15
  433. data/spec/models/update_milestone_spec.rb +9 -15
  434. data/spec/models/update_project_spec.rb +8 -14
  435. data/spec/models/update_stories_spec.rb +10 -16
  436. data/spec/models/update_story_comment_spec.rb +8 -14
  437. data/spec/models/update_story_contents_spec.rb +8 -14
  438. data/spec/models/update_story_link_spec.rb +9 -15
  439. data/spec/models/update_story_spec.rb +10 -16
  440. data/spec/models/update_task_spec.rb +8 -14
  441. data/spec/models/uploaded_file_spec.rb +8 -14
  442. data/spec/models/workflow_spec.rb +8 -14
  443. data/spec/models/workflow_state_spec.rb +8 -14
  444. data/spec/spec_helper.rb +4 -3
  445. metadata +18 -30
  446. data/docs/V3FilesBody.md +0 -11
  447. data/lib/shortcut/client/ruby/version.rb +0 -9
  448. data/lib/shortcut/client/ruby.rb +0 -12
  449. data/lib/shortcut_client_ruby/models/v3_files_body.rb +0 -252
  450. data/shortcut-client-ruby.gemspec +0 -36
  451. data/spec/base_object_spec.rb +0 -109
  452. data/spec/models/v3_files_body_spec.rb +0 -64
@@ -3,18 +3,20 @@
3
3
 
4
4
  #Shortcut API
5
5
 
6
- OpenAPI spec version: 3.0
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 'typhoeus'
17
- require 'uri'
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 = "Swagger-Codegen/#{VERSION}/ruby"
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
- request = build_request(http_method, path, opts)
50
- response = request.run
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
- if @config.debugging
53
- @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
54
- end
56
+ if config.debugging
57
+ config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
58
+ end
55
59
 
56
- unless response.success?
57
- if response.timed_out?
58
- fail ApiError.new('Connection timed out')
59
- elsif response.code == 0
60
- # Errors from libcurl will be made visible here
61
- fail ApiError.new(:code => 0,
62
- :message => response.return_message)
63
- else
64
- fail ApiError.new(:code => response.code,
65
- :response_headers => response.headers,
66
- :response_body => response.body),
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.code, response.headers
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 [Typhoeus::Request] A Typhoeus Request
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
- req_opts.update :body => req_body
120
- if @config.debugging
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
- request = Typhoeus::Request.new(url, req_opts)
126
- download_file(request) if opts[:return_type] == 'File'
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
- header_params['Content-Type'] == 'multipart/form-data'
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, ::Array, nil
144
- # let typhoeus handle File, Array and nil parameters
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
- return @tempfile if return_type == 'File'
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 DateTime).include?(return_type)
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 'DateTime'
293
+ when 'Time'
220
294
  # parse date time (expecting ISO 8601 format)
221
- DateTime.parse data
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, e.g. Pet
240
- Shortcut.const_get(return_type).build_from_hash(data)
241
- end
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 hearder and query params based on authentication settings.
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` of `header`'
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. swagger-codegen/ruby/1.0.0)
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
- # use application/json by default
337
- return 'application/json' if content_types.nil? || content_types.empty?
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 spec version: 3.0
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 spec version: 3.0
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 :verify_ssl
101
+ attr_accessor :ssl_verify
89
102
 
90
103
  ### TLS/SSL setting
91
- # Set this to false to skip verifying SSL host name
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
- # @return [true, false]
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 :cert_file
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 :key_file
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 encoding of array parameter with multi collectionFormat.
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 params_encoding option of Ethon. Related source code:
120
- # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
121
- attr_accessor :params_encoding
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 = 'https://api.app.shortcut.com/'
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
- @verify_ssl = true
136
- @verify_ssl_host = true
137
- @params_encoding = nil
138
- @cert_file = nil
139
- @key_file = nil
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
- def base_url
174
- "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
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]} #{@api_key[param_name]}"
208
+ "#{@api_key_prefix[param_name]} #{key}"
182
209
  else
183
- @api_key[param_name]
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('Shortcut-Token')
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