octokit 1.25.0 → 2.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (502) hide show
  1. data/Rakefile +10 -7
  2. data/lib/octokit.rb +22 -15
  3. data/lib/octokit/arguments.rb +14 -0
  4. data/lib/octokit/authentication.rb +48 -25
  5. data/lib/octokit/client.rb +245 -44
  6. data/lib/octokit/client/authorizations.rb +36 -10
  7. data/lib/octokit/client/commit_comments.rb +96 -0
  8. data/lib/octokit/client/commits.rb +152 -94
  9. data/lib/octokit/client/contents.rb +32 -24
  10. data/lib/octokit/client/downloads.rb +11 -7
  11. data/lib/octokit/client/emojis.rb +3 -1
  12. data/lib/octokit/client/events.rb +62 -18
  13. data/lib/octokit/client/gists.rb +27 -26
  14. data/lib/octokit/client/gitignore.rb +7 -3
  15. data/lib/octokit/client/issues.rb +43 -71
  16. data/lib/octokit/client/labels.rb +24 -20
  17. data/lib/octokit/client/legacy_search.rb +78 -0
  18. data/lib/octokit/client/markdown.rb +6 -1
  19. data/lib/octokit/client/meta.rb +21 -0
  20. data/lib/octokit/client/milestones.rb +13 -9
  21. data/lib/octokit/client/notifications.rb +24 -64
  22. data/lib/octokit/client/objects.rb +17 -12
  23. data/lib/octokit/client/organizations.rb +43 -52
  24. data/lib/octokit/client/pub_sub_hubbub.rb +68 -8
  25. data/lib/octokit/client/{pulls.rb → pull_requests.rb} +65 -41
  26. data/lib/octokit/client/rate_limit.rb +42 -8
  27. data/lib/octokit/client/refs.rb +16 -10
  28. data/lib/octokit/client/repositories.rb +73 -124
  29. data/lib/octokit/client/say.rb +7 -1
  30. data/lib/octokit/client/service_status.rb +39 -0
  31. data/lib/octokit/client/stats.rb +12 -6
  32. data/lib/octokit/client/statuses.rb +8 -29
  33. data/lib/octokit/client/users.rb +56 -75
  34. data/lib/octokit/configurable.rb +117 -0
  35. data/lib/octokit/default.rb +140 -0
  36. data/lib/octokit/error.rb +6 -5
  37. data/lib/octokit/gist.rb +11 -0
  38. data/lib/octokit/rate_limit.rb +22 -0
  39. data/lib/octokit/repo_arguments.rb +19 -0
  40. data/lib/octokit/repository.rb +11 -4
  41. data/lib/octokit/response/raise_error.rb +35 -0
  42. data/lib/octokit/version.rb +5 -1
  43. data/octokit.gemspec +4 -9
  44. data/spec/cassettes/Octokit_Client/_get/handles_query_params.json +1 -0
  45. data/spec/cassettes/Octokit_Client/_head/handles_query_params.json +1 -0
  46. data/spec/cassettes/Octokit_Client/_last_response/caches_the_last_agent_response.json +1 -0
  47. data/spec/cassettes/Octokit_Client/authentication/when_token_authenticated/fetches_and_memoizes_login.json +1 -0
  48. data/spec/cassettes/Octokit_Client/auto_pagination/fetches_all_the_pages.json +1 -0
  49. data/spec/cassettes/Octokit_Client/error_handling/raises_on_404.json +1 -0
  50. data/spec/cassettes/Octokit_Client_Authorizations/_authorization/returns_a_single_authorization.json +1 -0
  51. data/spec/cassettes/Octokit_Client_Authorizations/_authorizations/lists_existing_authorizations.json +1 -0
  52. data/spec/cassettes/Octokit_Client_Authorizations/_create_authorization/creates_a_new_authorization_with_options.json +1 -0
  53. data/spec/cassettes/Octokit_Client_Authorizations/_create_authorization/creates_an_API_authorization.json +1 -0
  54. data/spec/cassettes/Octokit_Client_Authorizations/_scopes/checks_the_scopes_on_a_one-off_token.json +1 -0
  55. data/spec/cassettes/Octokit_Client_Authorizations/_scopes/checks_the_scopes_on_the_current_token.json +1 -0
  56. data/spec/cassettes/Octokit_Client_Authorizations/_update_authorization/updates_and_existing_authorization.json +1 -0
  57. data/spec/cassettes/Octokit_Client_CommitComments/_commit_comment/returns_a_single_commit_comment.json +1 -0
  58. data/spec/cassettes/Octokit_Client_CommitComments/_commit_comments/returns_a_list_of_comments_for_a_specific_commit.json +1 -0
  59. data/spec/cassettes/Octokit_Client_CommitComments/_create_commit_comment/creates_a_commit_comment.json +1 -0
  60. data/spec/cassettes/Octokit_Client_CommitComments/_delete_commit_comment/deletes_a_commit_comment.json +1 -0
  61. data/spec/cassettes/Octokit_Client_CommitComments/_list_commit_comments/returns_a_list_of_all_commit_comments.json +1 -0
  62. data/spec/cassettes/Octokit_Client_CommitComments/_update_commit_comment/updates_a_commit_comment.json +1 -0
  63. data/spec/cassettes/Octokit_Client_Commits/_commit/returns_a_commit.json +1 -0
  64. data/spec/cassettes/Octokit_Client_Commits/_commits/handles_branch_or_sha_argument.json +1 -0
  65. data/spec/cassettes/Octokit_Client_Commits/_commits/handles_the_sha_option.json +1 -0
  66. data/spec/cassettes/Octokit_Client_Commits/_commits/returns_all_commits.json +1 -0
  67. data/spec/cassettes/Octokit_Client_Commits/_commits_before/handles_branch_or_sha_argument.json +1 -0
  68. data/spec/cassettes/Octokit_Client_Commits/_commits_before/handles_the_sha_option.json +1 -0
  69. data/spec/cassettes/Octokit_Client_Commits/_commits_before/returns_all_commits_until_the_specified_date.json +1 -0
  70. data/spec/cassettes/Octokit_Client_Commits/_commits_between/handles_branch_or_sha_argument.json +1 -0
  71. data/spec/cassettes/Octokit_Client_Commits/_commits_between/handles_the_sha_option.json +1 -0
  72. data/spec/cassettes/Octokit_Client_Commits/_commits_between/returns_all_commits_until_the_specified_date.json +1 -0
  73. data/spec/cassettes/Octokit_Client_Commits/_commits_on/handles_branch_or_sha_argument.json +1 -0
  74. data/spec/cassettes/Octokit_Client_Commits/_commits_on/handles_the_sha_option.json +1 -0
  75. data/spec/cassettes/Octokit_Client_Commits/_commits_on/returns_all_commits_on_the_specified_date.json +1 -0
  76. data/spec/cassettes/Octokit_Client_Commits/_commits_since/handles_branch_or_sha_argument.json +1 -0
  77. data/spec/cassettes/Octokit_Client_Commits/_commits_since/handles_the_sha_option.json +1 -0
  78. data/spec/cassettes/Octokit_Client_Commits/_commits_since/returns_all_commits_since_the_specified_date.json +1 -0
  79. data/spec/cassettes/Octokit_Client_Commits/_compare/returns_a_comparison.json +1 -0
  80. data/spec/cassettes/Octokit_Client_Commits/_create_commit/creates_a_commit.json +1 -0
  81. data/spec/cassettes/Octokit_Client_Commits/_merge/merges_a_branch_into_another.json +1 -0
  82. data/spec/cassettes/Octokit_Client_Contents/_archive_link/returns_the_headers_of_the_request.json +1 -0
  83. data/spec/cassettes/Octokit_Client_Contents/_contents/returns_the_contents_of_a_file.json +1 -0
  84. data/spec/cassettes/Octokit_Client_Contents/_create_contents/creates_contents_from_File_object.json +1 -0
  85. data/spec/cassettes/Octokit_Client_Contents/_create_contents/creates_contents_from_file_path.json +1 -0
  86. data/spec/cassettes/Octokit_Client_Contents/_create_contents/creates_repository_contents_at_a_path.json +1 -0
  87. data/spec/cassettes/Octokit_Client_Contents/_delete_contents/deletes_repository_contents_at_a_path.json +1 -0
  88. data/spec/cassettes/Octokit_Client_Contents/_readme/returns_the_default_readme.json +1 -0
  89. data/spec/cassettes/Octokit_Client_Contents/_update_contents/updates_repository_contents_at_a_path.json +1 -0
  90. data/spec/cassettes/Octokit_Client_Downloads/_download/gets_a_single_download.json +1 -0
  91. data/spec/cassettes/Octokit_Client_Downloads/_downloads/lists_available_downloads.json +1 -0
  92. data/spec/cassettes/Octokit_Client_Downloads/methods_that_require_a_download/_create_download/creates_a_download_resource.json +1 -0
  93. data/spec/cassettes/Octokit_Client_Downloads/methods_that_require_a_download/_create_download/posts_to_an_S3_url.json +1 -0
  94. data/spec/cassettes/Octokit_Client_Downloads/methods_that_require_a_download/_delete_download/deletes_a_download.json +1 -0
  95. data/spec/cassettes/Octokit_Client_Emojis/_emojis/returns_all_github_emojis.json +1 -0
  96. data/spec/cassettes/Octokit_Client_Events/_issue_event/lists_issue_events_for_a_repository.json +1 -0
  97. data/spec/cassettes/Octokit_Client_Events/_issue_events/lists_issue_events_for_a_repository.json +1 -0
  98. data/spec/cassettes/Octokit_Client_Events/_organization_events/returns_all_events_for_an_organization.json +1 -0
  99. data/spec/cassettes/Octokit_Client_Events/_organization_public_events/returns_an_organization_s_public_events.json +1 -0
  100. data/spec/cassettes/Octokit_Client_Events/_public_events/returns_all_public_events.json +1 -0
  101. data/spec/cassettes/Octokit_Client_Events/_received_events/returns_all_user_received_events.json +1 -0
  102. data/spec/cassettes/Octokit_Client_Events/_received_public_events/returns_public_user_received_events.json +1 -0
  103. data/spec/cassettes/Octokit_Client_Events/_repo_issue_events/lists_issue_events_for_a_repository.json +1 -0
  104. data/spec/cassettes/Octokit_Client_Events/_repository_events/returns_events_for_a_repository.json +1 -0
  105. data/spec/cassettes/Octokit_Client_Events/_repository_network_events/returns_events_for_a_repository_s_network.json +1 -0
  106. data/spec/cassettes/Octokit_Client_Events/_user_events/returns_all_user_events.json +1 -0
  107. data/spec/cassettes/Octokit_Client_Events/_user_public_events/returns_public_events_performed_by_a_user.json +1 -0
  108. data/spec/cassettes/Octokit_Client_Gists/unauthenticated/_gist/returns_the_gist_by_ID.json +1 -0
  109. data/spec/cassettes/Octokit_Client_Gists/unauthenticated/_gists/with_username_passed/returns_a_list_of_gists.json +1 -0
  110. data/spec/cassettes/Octokit_Client_Gists/unauthenticated/_gists/without_a_username_passed/returns_a_list_of_gists.json +1 -0
  111. data/spec/cassettes/Octokit_Client_Gists/unauthenticated/_public_gists/returns_public_gists.json +1 -0
  112. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_create_gist/creates_a_new_gist.json +1 -0
  113. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_create_gist_comment/creates_a_gist_comment.json +1 -0
  114. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_delete_gist/deletes_an_existing_gist.json +1 -0
  115. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_delete_gist_comment/deletes_a_gist_comment.json +1 -0
  116. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_edit_gist/edit_an_existing_gist.json +1 -0
  117. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_fork_gist/forks_an_existing_gist.json +1 -0
  118. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gist_comment/returns_a_gist_comment.json +1 -0
  119. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gist_comments/returns_the_list_of_gist_comments.json +1 -0
  120. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gist_starred_/is_not_starred.json +1 -0
  121. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gist_starred_/is_starred.json +1 -0
  122. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_gists/returns_a_list_of_gists.json +1 -0
  123. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_star_gist/stars_an_existing_gist.json +1 -0
  124. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_starred_gists/returns_the_user_s_starred_gists.json +1 -0
  125. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_unstar_gist/unstars_an_existing_gist.json +1 -0
  126. data/spec/cassettes/Octokit_Client_Gists/when_authenticated/_update_gist_comment/updates_a_gist_comment.json +1 -0
  127. data/spec/cassettes/Octokit_Client_Gitignore/_gitignore_template/returns_the_ruby_gitignore_template.json +1 -0
  128. data/spec/cassettes/Octokit_Client_Gitignore/_gitignore_templates/returns_all_gitignore_templates.json +1 -0
  129. data/spec/cassettes/Octokit_Client_Issues/_create_issue/creates_an_issue.json +1 -0
  130. data/spec/cassettes/Octokit_Client_Issues/_create_issue/creates_an_issue_with_delimited_labels.json +1 -0
  131. data/spec/cassettes/Octokit_Client_Issues/_create_issue/creates_an_issue_with_labels_array.json +1 -0
  132. data/spec/cassettes/Octokit_Client_Issues/_issue_comment/returns_a_single_comment_for_an_issue.json +1 -0
  133. data/spec/cassettes/Octokit_Client_Issues/_issue_comments/returns_comments_for_an_issue.json +1 -0
  134. data/spec/cassettes/Octokit_Client_Issues/_list_issues/returns_dashboard_issues_for_the_authenticated_user.json +1 -0
  135. data/spec/cassettes/Octokit_Client_Issues/_list_issues/returns_issues_for_a_repository.json +1 -0
  136. data/spec/cassettes/Octokit_Client_Issues/_org_issues/returns_issues_for_the_organization_for_the_authenticated_user.json +1 -0
  137. data/spec/cassettes/Octokit_Client_Issues/_repository_issues_comments/returns_comments_for_all_issues_in_a_repository.json +1 -0
  138. data/spec/cassettes/Octokit_Client_Issues/_user_issues/returns_issues_for_the_authenticated_user_for_owned_and_member_repos.json +1 -0
  139. data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_add_comment/adds_a_comment.json +1 -0
  140. data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_close_issue/closes_an_issue.json +1 -0
  141. data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_issue/returns_a_full_issue.json +1 -0
  142. data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_issue/returns_an_issue.json +1 -0
  143. data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_reopen_issue/reopens_an_issue.json +1 -0
  144. data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/_update_issue/updates_an_issue.json +1 -0
  145. data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/methods_requiring_a_new_issue_comment/_delete_comment/deletes_an_existing_comment.json +1 -0
  146. data/spec/cassettes/Octokit_Client_Issues/methods_requiring_a_new_issue/methods_requiring_a_new_issue_comment/_update_comment/updates_an_existing_comment.json +1 -0
  147. data/spec/cassettes/Octokit_Client_Labels/_add_label/adds_a_label_with_a_color.json +1 -0
  148. data/spec/cassettes/Octokit_Client_Labels/_add_label/adds_a_label_with_default_color.json +1 -0
  149. data/spec/cassettes/Octokit_Client_Labels/_delete_label_/deletes_a_label_from_the_repository.json +1 -0
  150. data/spec/cassettes/Octokit_Client_Labels/_label/returns_a_single_label.json +1 -0
  151. data/spec/cassettes/Octokit_Client_Labels/_labels/returns_labels.json +1 -0
  152. data/spec/cassettes/Octokit_Client_Labels/_lables_for_milestone/returns_all_labels_for_a_repository.json +1 -0
  153. data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_add_labels_to_an_issue/adds_labels_to_a_given_issue.json +1 -0
  154. data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_labels_for_issue/returns_all_labels_for_a_given_issue.json +1 -0
  155. data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_remove_all_labels/removes_all_labels_from_the_specified_issue.json +1 -0
  156. data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_remove_label/removes_a_label_from_the_specified_issue.json +1 -0
  157. data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_issue/_replace_all_labels/replaces_all_labels_for_an_issue.json +1 -0
  158. data/spec/cassettes/Octokit_Client_Labels/methods_requiring_a_new_label/_update_label/updates_a_label_with_a_new_color.json +1 -0
  159. data/spec/cassettes/Octokit_Client_LegacySearch/_legacy_search_issues/returns_matching_issues.json +1 -0
  160. data/spec/cassettes/Octokit_Client_LegacySearch/_legacy_search_repos/returns_matching_repositories.json +1 -0
  161. data/spec/cassettes/Octokit_Client_LegacySearch/_legacy_search_users/returns_matching_username.json +1 -0
  162. data/spec/cassettes/Octokit_Client_Markdown/_markdown/renders_markdown.json +1 -0
  163. data/spec/cassettes/Octokit_Client_Meta/_github_meta/returns_meta_information_about_github.json +1 -0
  164. data/spec/cassettes/Octokit_Client_Milestones/_list_milestones/lists_milestones_belonging_to_repository.json +1 -0
  165. data/spec/cassettes/Octokit_Client_Milestones/methods_that_need_a_milestone/_create_milestone/creates_a_milestone.json +1 -0
  166. data/spec/cassettes/Octokit_Client_Milestones/methods_that_need_a_milestone/_delete_milestone/deletes_a_milestone_from_a_repository.json +1 -0
  167. data/spec/cassettes/Octokit_Client_Milestones/methods_that_need_a_milestone/_milestone/gets_a_single_milestone_belonging_to_repository.json +1 -0
  168. data/spec/cassettes/Octokit_Client_Milestones/methods_that_need_a_milestone/_update_milestone/updates_a_milestone.json +1 -0
  169. data/spec/cassettes/Octokit_Client_Notifications/_mark_notifications_as_read/returns_true_when_notifications_are_marked_as_read.json +1 -0
  170. data/spec/cassettes/Octokit_Client_Notifications/_mark_repository_notifications_as_read/returns_true_when_notifications_for_a_repo_are_marked_as_read.json +1 -0
  171. data/spec/cassettes/Octokit_Client_Notifications/_notifications/lists_the_notifications_for_the_current_user.json +1 -0
  172. data/spec/cassettes/Octokit_Client_Notifications/_repository_notifications/lists_all_notifications_for_a_repository.json +1 -0
  173. data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_delete_thread_subscription/returns_true_with_successful_thread_deletion.json +1 -0
  174. data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_mark_thread_as_read/marks_a_thread_as_read.json +1 -0
  175. data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_thread_notifications/returns_notifications_for_a_specific_thread.json +1 -0
  176. data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_thread_subscription/returns_a_thread_subscription.json +1 -0
  177. data/spec/cassettes/Octokit_Client_Notifications/methods_that_need_a_thread_context/_update_thread_subscription/updates_a_thread_subscription.json +1 -0
  178. data/spec/cassettes/Octokit_Client_Objects/_blob/returns_a_blob.json +1 -0
  179. data/spec/cassettes/Octokit_Client_Objects/_create_blob/creates_a_blob.json +1 -0
  180. data/spec/cassettes/Octokit_Client_Objects/_create_tag/creates_a_tag.json +1 -0
  181. data/spec/cassettes/Octokit_Client_Objects/_create_tree/creates_a_tree.json +1 -0
  182. data/spec/cassettes/Octokit_Client_Objects/_tag/returns_a_tag.json +1 -0
  183. data/spec/cassettes/Octokit_Client_Objects/_tree/gets_a_tree.json +1 -0
  184. data/spec/cassettes/Octokit_Client_Objects/_tree/gets_a_tree_recursively.json +1 -0
  185. data/spec/cassettes/Octokit_Client_Organizations/_organization/returns_an_organization.json +1 -0
  186. data/spec/cassettes/Octokit_Client_Organizations/_organization_member_/checks_organization_membership.json +1 -0
  187. data/spec/cassettes/Octokit_Client_Organizations/_organization_members/returns_all_public_members_of_an_organization.json +1 -0
  188. data/spec/cassettes/Octokit_Client_Organizations/_organization_public_member_/checks_publicized_org_membership.json +1 -0
  189. data/spec/cassettes/Octokit_Client_Organizations/_organization_repositories/returns_all_public_repositories_for_an_organization.json +1 -0
  190. data/spec/cassettes/Octokit_Client_Organizations/_organization_teams/returns_all_teams_for_an_organization.json +1 -0
  191. data/spec/cassettes/Octokit_Client_Organizations/_organizations/returns_all_organizations_for_a_user.json +1 -0
  192. data/spec/cassettes/Octokit_Client_Organizations/_organizations/returns_all_organizations_for_the_authenticated_user.json +1 -0
  193. data/spec/cassettes/Octokit_Client_Organizations/_update_organization/updates_an_organization.json +1 -0
  194. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_add_team_member/adds_a_team_member.json +1 -0
  195. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_add_team_repository/adds_a_team_repository.json +1 -0
  196. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_create_team/creates_a_team.json +1 -0
  197. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_delete_team/deletes_a_team.json +1 -0
  198. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_publicize_membership/publicizes_membership.json +1 -0
  199. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_remove_team_member/removes_a_team_member.json +1 -0
  200. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_remove_team_repository/removes_a_team_repository.json +1 -0
  201. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_team/returns_a_team.json +1 -0
  202. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_team_member_/checks_if_a_user_is_member_of_a_team.json +1 -0
  203. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_team_members/returns_team_members.json +1 -0
  204. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_team_repositories/returns_team_repositories.json +1 -0
  205. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_unpublicize_membership/unpublicizes_membership.json +1 -0
  206. data/spec/cassettes/Octokit_Client_Organizations/methods_that_require_a_new_team/_update_team/updates_a_team.json +1 -0
  207. data/spec/cassettes/Octokit_Client_PubSubHubbub/_subscribe/raises_an_error_when_topic_is_not_recognized.json +1 -0
  208. data/spec/cassettes/Octokit_Client_PubSubHubbub/_subscribe/subscribes_to_pull_events.json +1 -0
  209. data/spec/cassettes/Octokit_Client_PubSubHubbub/_subscribe_service_hook/subscribes_to_pull_events_on_specified_topic.json +1 -0
  210. data/spec/cassettes/Octokit_Client_PubSubHubbub/_unsubscribe/unsubscribes_from_pull_events.json +1 -0
  211. data/spec/cassettes/Octokit_Client_PubSubHubbub/unsubscribe_service_hook/unsubscribes_to_stop_receiving_events_on_specified_topic.json +1 -0
  212. data/spec/cassettes/Octokit_Client_PullRequests/_create_pull_request_for_issue/creates_a_pull_request_and_attach_it_to_an_existing_issue.json +1 -0
  213. data/spec/cassettes/Octokit_Client_PullRequests/_pull_request_comment/returns_a_comment_on_a_pull_request.json +1 -0
  214. data/spec/cassettes/Octokit_Client_PullRequests/_pull_request_comments/returns_the_comments_for_a_pull_request.json +1 -0
  215. data/spec/cassettes/Octokit_Client_PullRequests/_pull_request_commits/returns_the_commits_for_a_pull_request.json +1 -0
  216. data/spec/cassettes/Octokit_Client_PullRequests/_pull_request_files/lists_files_for_a_pull_request.json +1 -0
  217. data/spec/cassettes/Octokit_Client_PullRequests/_pull_requests/returns_all_pull_requests.json +1 -0
  218. data/spec/cassettes/Octokit_Client_PullRequests/_pull_requests_comments/returns_all_comments_on_all_pull_requests.json +1 -0
  219. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_close_pull_request/closes_a_pull_request.json +1 -0
  220. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_create_pull_request/creates_a_pull_request.json +1 -0
  221. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_merge_pull_request/merges_the_pull_request.json +1 -0
  222. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_pull_merged_/returns_whether_the_pull_request_has_been_merged.json +1 -0
  223. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_pull_request/returns_a_pull_request.json +1 -0
  224. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/_update_pull_request/updates_a_pull_request.json +1 -0
  225. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/methods_requiring_a_pull_request_comment/_create_pull_request_comment/creates_a_new_comment_on_a_pull_request.json +1 -0
  226. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/methods_requiring_a_pull_request_comment/_create_pull_request_comment_reply/creates_a_new_reply_to_a_pull_request_comment.json +1 -0
  227. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/methods_requiring_a_pull_request_comment/_delete_pull_request_comment/deletes_a_pull_request_comment.json +1 -0
  228. data/spec/cassettes/Octokit_Client_PullRequests/methods_that_require_a_new_pull/methods_requiring_a_pull_request_comment/_update_pull_request_comment/updates_a_pull_request_comment.json +1 -0
  229. data/spec/cassettes/Octokit_Client_Refs/_ref/returns_a_tags_ref.json +1 -0
  230. data/spec/cassettes/Octokit_Client_Refs/_refs/returns_all_refs.json +1 -0
  231. data/spec/cassettes/Octokit_Client_Refs/_refs/returns_all_tag_refs.json +1 -0
  232. data/spec/cassettes/Octokit_Client_Refs/methods_that_require_a_ref/_create_ref/creates_a_ref.json +1 -0
  233. data/spec/cassettes/Octokit_Client_Refs/methods_that_require_a_ref/_delete_ref/deletes_an_existing_ref.json +1 -0
  234. data/spec/cassettes/Octokit_Client_Refs/methods_that_require_a_ref/_update_ref/updates_a_ref.json +1 -0
  235. data/spec/cassettes/Octokit_Client_Repositories/_all_repositories/returns_all_repositories_on_github.json +1 -0
  236. data/spec/cassettes/Octokit_Client_Repositories/_assignees/lists_all_the_available_assignees_owner_collaborators_.json +1 -0
  237. data/spec/cassettes/Octokit_Client_Repositories/_branches/returns_a_repository_s_branches.json +1 -0
  238. data/spec/cassettes/Octokit_Client_Repositories/_branches/returns_a_single_branch.json +1 -0
  239. data/spec/cassettes/Octokit_Client_Repositories/_check_assignee/checks_to_see_if_a_particular_user_is_an_assignee_for_a_repository.json +1 -0
  240. data/spec/cassettes/Octokit_Client_Repositories/_collaborators/returns_a_repository_s_collaborators.json +1 -0
  241. data/spec/cassettes/Octokit_Client_Repositories/_contributors/returns_repository_contributors.json +1 -0
  242. data/spec/cassettes/Octokit_Client_Repositories/_contributors/returns_repository_contributors_excluding_anonymous.json +1 -0
  243. data/spec/cassettes/Octokit_Client_Repositories/_create_repository/creates_a_repository_for_an_organization.json +1 -0
  244. data/spec/cassettes/Octokit_Client_Repositories/_delete_subscription/returns_true_when_repo_subscription_deleted.json +1 -0
  245. data/spec/cassettes/Octokit_Client_Repositories/_fork/forks_a_repository.json +1 -0
  246. data/spec/cassettes/Octokit_Client_Repositories/_languages/returns_a_repository_s_languages.json +1 -0
  247. data/spec/cassettes/Octokit_Client_Repositories/_network/returns_a_repository_s_network.json +1 -0
  248. data/spec/cassettes/Octokit_Client_Repositories/_repositories/returns_a_user_s_repositories.json +1 -0
  249. data/spec/cassettes/Octokit_Client_Repositories/_repositories/returns_authenticated_user_s_repositories.json +1 -0
  250. data/spec/cassettes/Octokit_Client_Repositories/_repository/returns_the_matching_repository.json +1 -0
  251. data/spec/cassettes/Octokit_Client_Repositories/_repository_/returns_false_if_the_repository_doesn_t_exist.json +1 -0
  252. data/spec/cassettes/Octokit_Client_Repositories/_repository_/returns_true_if_the_repository_exists.json +1 -0
  253. data/spec/cassettes/Octokit_Client_Repositories/_star/stars_a_repository.json +1 -0
  254. data/spec/cassettes/Octokit_Client_Repositories/_stargazers/returns_all_repository_stargazers.json +1 -0
  255. data/spec/cassettes/Octokit_Client_Repositories/_subscribers/lists_all_the_users_watching_the_repository.json +1 -0
  256. data/spec/cassettes/Octokit_Client_Repositories/_subscription/returns_a_repository_subscription.json +1 -0
  257. data/spec/cassettes/Octokit_Client_Repositories/_tags/returns_a_repository_s_tags.json +1 -0
  258. data/spec/cassettes/Octokit_Client_Repositories/_unstar/unstars_a_repository.json +1 -0
  259. data/spec/cassettes/Octokit_Client_Repositories/_unwatch/unwatches_a_repository.json +1 -0
  260. data/spec/cassettes/Octokit_Client_Repositories/_update_subscription/updates_a_repository_subscription.json +1 -0
  261. data/spec/cassettes/Octokit_Client_Repositories/_watch/watches_a_repository.json +1 -0
  262. data/spec/cassettes/Octokit_Client_Repositories/_watchers/returns_all_repository_watchers.json +1 -0
  263. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_add_collaborator/adds_a_repository_collaborators.json +1 -0
  264. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_create_repository/creates_a_repository.json +1 -0
  265. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_delete_repository/deletes_a_repository.json +1 -0
  266. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_deploy_keys/returns_a_repository_s_deploy_keys.json +1 -0
  267. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_hooks/returns_a_repository_s_hooks.json +1 -0
  268. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_remove_collaborator/removes_a_repository_collaborators.json +1 -0
  269. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_repository_teams/returns_all_repository_teams.json +1 -0
  270. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/_update_repository/updates_the_matching_repository.json +1 -0
  271. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_requiring_an_existing_deploy_key/_add_deploy_key/adds_a_repository_deploy_keys.json +1 -0
  272. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_create_hook/creates_a_hook.json +1 -0
  273. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_edit_hook/edits_a_hook.json +1 -0
  274. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_hook/returns_a_repository_s_single_hook.json +1 -0
  275. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_remove_hook/removes_a_hook.json +1 -0
  276. data/spec/cassettes/Octokit_Client_Repositories/methods_that_require_a_new_repo/methods_that_need_an_existing_hook/_test_hook/tests_a_hook.json +1 -0
  277. data/spec/cassettes/Octokit_Client_Say/_say/returns_an_ASCII_octocat.json +1 -0
  278. data/spec/cassettes/Octokit_Client_Say/_say/returns_an_ASCII_octocat_with_custom_text.json +1 -0
  279. data/spec/cassettes/Octokit_Client_ServiceStatus/_github_status/returns_the_current_system_status.json +1 -0
  280. data/spec/cassettes/Octokit_Client_ServiceStatus/_github_status/returns_the_most_recent_status_messages.json +1 -0
  281. data/spec/cassettes/Octokit_Client_ServiceStatus/_github_status_last_message/returns_the_last_human_message.json +1 -0
  282. data/spec/cassettes/Octokit_Client_Stats/_code_frequency_stats/returns_the_code_frequency_stats.json +1 -0
  283. data/spec/cassettes/Octokit_Client_Stats/_commit_activity_stats/returns_the_commit_activity_stats.json +1 -0
  284. data/spec/cassettes/Octokit_Client_Stats/_contributors_stats/returns_contributors_and_their_contribution_stats.json +1 -0
  285. data/spec/cassettes/Octokit_Client_Stats/_participation_stats/returns_the_owner_and_contributor_participation_stats.json +1 -0
  286. data/spec/cassettes/Octokit_Client_Stats/_punch_card_stats/returns_commit_count_by_hour_punch_card_stats.json +1 -0
  287. data/spec/cassettes/Octokit_Client_Statuses/_create_status/creates_status.json +1 -0
  288. data/spec/cassettes/Octokit_Client_Statuses/_statuses/lists_commit_statuses.json +1 -0
  289. data/spec/cassettes/Octokit_Client_Users/_add_email/adds_an_email_address.json +1 -0
  290. data/spec/cassettes/Octokit_Client_Users/_all_users/returns_all_GitHub_users.json +1 -0
  291. data/spec/cassettes/Octokit_Client_Users/_emails/returns_email_addresses.json +1 -0
  292. data/spec/cassettes/Octokit_Client_Users/_follow/follows_a_user.json +1 -0
  293. data/spec/cassettes/Octokit_Client_Users/_followers/returns_followers_for_a_user.json +1 -0
  294. data/spec/cassettes/Octokit_Client_Users/_followers/returns_the_authenticated_user_s_followers.json +1 -0
  295. data/spec/cassettes/Octokit_Client_Users/_following/returns_following_for_a_user.json +1 -0
  296. data/spec/cassettes/Octokit_Client_Users/_following/returns_the_authenticated_user_s_following.json +1 -0
  297. data/spec/cassettes/Octokit_Client_Users/_follows_/checks_if_the_authenticated_user_follows_another.json +1 -0
  298. data/spec/cassettes/Octokit_Client_Users/_keys/returns_public_keys_for_the_authenticated_user.json +1 -0
  299. data/spec/cassettes/Octokit_Client_Users/_remove_email/removes_an_email_address.json +1 -0
  300. data/spec/cassettes/Octokit_Client_Users/_starred/returns_starred_repositories_for_a_user.json +1 -0
  301. data/spec/cassettes/Octokit_Client_Users/_starred/returns_starred_repositories_for_the_authenticated_user.json +1 -0
  302. data/spec/cassettes/Octokit_Client_Users/_starred_/checks_if_the_authenticated_user_has_starred_a_repository.json +1 -0
  303. data/spec/cassettes/Octokit_Client_Users/_subscriptions/returns_the_repositories_a_user_watches_for_notifications.json +1 -0
  304. data/spec/cassettes/Octokit_Client_Users/_subscriptions/returns_the_repositories_the_authenticated_user_watches_for_notifications.json +1 -0
  305. data/spec/cassettes/Octokit_Client_Users/_unfollow/unfollows_a_user.json +1 -0
  306. data/spec/cassettes/Octokit_Client_Users/_update_user/updates_a_user_profile.json +1 -0
  307. data/spec/cassettes/Octokit_Client_Users/_user/returns_a_user.json +1 -0
  308. data/spec/cassettes/Octokit_Client_Users/_user/returns_the_authenticated_user.json +1 -0
  309. data/spec/cassettes/Octokit_Client_Users/_user_keys/returns_public_keys_for_another_user.json +1 -0
  310. data/spec/cassettes/Octokit_Client_Users/_validate_credentials/validates_username_and_password.json +1 -0
  311. data/spec/cassettes/Octokit_Client_Users/methods_requiring_an_existing_public_key/_add_key/adds_a_public_key.json +1 -0
  312. data/spec/cassettes/Octokit_Client_Users/methods_requiring_an_existing_public_key/_key/returns_a_public_key.json +1 -0
  313. data/spec/cassettes/Octokit_Client_Users/methods_requiring_an_existing_public_key/_remove_key/removes_a_public_key.json +1 -0
  314. data/spec/cassettes/Octokit_Client_Users/methods_requiring_an_existing_public_key/_update_key/updates_a_public_key.json +1 -0
  315. data/spec/cassettes/delete_authorization.json +1 -0
  316. data/spec/cassettes/rate_limit.json +1 -0
  317. data/spec/cassettes/root.json +1 -0
  318. data/spec/fixtures/user.json +29 -18
  319. data/spec/fixtures/{user_token.json → web_flow_token.json} +0 -0
  320. data/spec/helper.rb +49 -22
  321. data/spec/octokit/client/authorizations_spec.rb +69 -80
  322. data/spec/octokit/client/commit_comments_spec.rb +62 -0
  323. data/spec/octokit/client/commits_spec.rb +93 -226
  324. data/spec/octokit/client/contents_spec.rb +64 -119
  325. data/spec/octokit/client/downloads_spec.rb +34 -38
  326. data/spec/octokit/client/emojis_spec.rb +5 -11
  327. data/spec/octokit/client/events_spec.rb +67 -51
  328. data/spec/octokit/client/gists_spec.rb +148 -142
  329. data/spec/octokit/client/gitignore_spec.rb +11 -14
  330. data/spec/octokit/client/issues_spec.rb +129 -161
  331. data/spec/octokit/client/labels_spec.rb +81 -114
  332. data/spec/octokit/client/legacy_search_spec.rb +42 -0
  333. data/spec/octokit/client/markdown_spec.rb +9 -12
  334. data/spec/octokit/client/meta_spec.rb +14 -0
  335. data/spec/octokit/client/milestones_spec.rb +40 -48
  336. data/spec/octokit/client/notifications_spec.rb +57 -113
  337. data/spec/octokit/client/objects_spec.rb +36 -74
  338. data/spec/octokit/client/organizations_spec.rb +140 -262
  339. data/spec/octokit/client/pub_sub_hubbub_spec.rb +58 -49
  340. data/spec/octokit/client/pull_requests_spec.rb +186 -0
  341. data/spec/octokit/client/rate_limit_spec.rb +40 -0
  342. data/spec/octokit/client/refs_spec.rb +47 -56
  343. data/spec/octokit/client/repositories_spec.rb +301 -438
  344. data/spec/octokit/client/say_spec.rb +8 -22
  345. data/spec/octokit/client/service_status_spec.rb +37 -0
  346. data/spec/octokit/client/stats_spec.rb +82 -32
  347. data/spec/octokit/client/statuses_spec.rb +11 -51
  348. data/spec/octokit/client/users_spec.rb +144 -348
  349. data/spec/octokit/client_spec.rb +345 -195
  350. data/spec/octokit/rate_limit_spec.rb +25 -0
  351. data/spec/octokit_spec.rb +31 -15
  352. metadata +585 -387
  353. data/lib/faraday/response/raise_octokit_error.rb +0 -25
  354. data/lib/octokit/client/github.rb +0 -19
  355. data/lib/octokit/client/pub_sub_hubbub/service_hooks.rb +0 -37
  356. data/lib/octokit/configuration.rb +0 -77
  357. data/lib/octokit/connection.rb +0 -53
  358. data/lib/octokit/request.rb +0 -110
  359. data/spec/faraday/response_spec.rb +0 -63
  360. data/spec/fixtures/all_repositories.json +0 -122
  361. data/spec/fixtures/all_users.json +0 -34
  362. data/spec/fixtures/authorization.json +0 -16
  363. data/spec/fixtures/authorizations.json +0 -66
  364. data/spec/fixtures/blob.json +0 -7
  365. data/spec/fixtures/blob_create.json +0 -3
  366. data/spec/fixtures/branches.json +0 -16
  367. data/spec/fixtures/code_frequency_stats.json +0 -897
  368. data/spec/fixtures/collaborators.json +0 -62
  369. data/spec/fixtures/comment.json +0 -14
  370. data/spec/fixtures/comments.json +0 -44
  371. data/spec/fixtures/commit.json +0 -50
  372. data/spec/fixtures/commit_activity_stats.json +0 -678
  373. data/spec/fixtures/commit_comment.json +0 -19
  374. data/spec/fixtures/commit_comment_create.json +0 -19
  375. data/spec/fixtures/commit_comment_update.json +0 -19
  376. data/spec/fixtures/commit_comments.json +0 -78
  377. data/spec/fixtures/commit_create.json +0 -25
  378. data/spec/fixtures/commits.json +0 -1414
  379. data/spec/fixtures/compare.json +0 -98
  380. data/spec/fixtures/contents.json +0 -14
  381. data/spec/fixtures/contributor_stats.json +0 -2196
  382. data/spec/fixtures/contributors.json +0 -891
  383. data/spec/fixtures/create_content.json +0 -44
  384. data/spec/fixtures/delete_content.json +0 -30
  385. data/spec/fixtures/download.json +0 -11
  386. data/spec/fixtures/download_create.json +0 -21
  387. data/spec/fixtures/downloads.json +0 -35
  388. data/spec/fixtures/emails.json +0 -4
  389. data/spec/fixtures/emojis.json +0 -500
  390. data/spec/fixtures/followers.json +0 -212
  391. data/spec/fixtures/following.json +0 -209
  392. data/spec/fixtures/forks.json +0 -872
  393. data/spec/fixtures/gist.json +0 -51
  394. data/spec/fixtures/gist_comment.json +0 -19
  395. data/spec/fixtures/gist_comment_create.json +0 -19
  396. data/spec/fixtures/gist_comment_update.json +0 -19
  397. data/spec/fixtures/gist_comments.json +0 -40
  398. data/spec/fixtures/gists.json +0 -548
  399. data/spec/fixtures/github_meta.json +0 -9
  400. data/spec/fixtures/github_status.json +0 -4
  401. data/spec/fixtures/github_status_last_message.json +0 -5
  402. data/spec/fixtures/github_status_messages.json +0 -12
  403. data/spec/fixtures/gitignore_template_ruby.json +0 -4
  404. data/spec/fixtures/gitignore_templates.json +0 -78
  405. data/spec/fixtures/hook.json +0 -18
  406. data/spec/fixtures/hooks.json +0 -70
  407. data/spec/fixtures/issue.json +0 -35
  408. data/spec/fixtures/issue_closed.json +0 -35
  409. data/spec/fixtures/issue_event.json +0 -42
  410. data/spec/fixtures/issue_events.json +0 -72
  411. data/spec/fixtures/issue_full.json +0 -38
  412. data/spec/fixtures/issues.json +0 -1562
  413. data/spec/fixtures/label.json +0 -5
  414. data/spec/fixtures/labels.json +0 -17
  415. data/spec/fixtures/languages.json +0 -5
  416. data/spec/fixtures/legacy/issues.json +0 -49
  417. data/spec/fixtures/legacy/repositories.json +0 -173
  418. data/spec/fixtures/legacy/users.json +0 -24
  419. data/spec/fixtures/list_commit_comments.json +0 -572
  420. data/spec/fixtures/markdown_gfm +0 -1
  421. data/spec/fixtures/merge.json +0 -47
  422. data/spec/fixtures/milestone.json +0 -11
  423. data/spec/fixtures/milestones.json +0 -28
  424. data/spec/fixtures/not_found.json +0 -3
  425. data/spec/fixtures/notification_thread.json +0 -32
  426. data/spec/fixtures/notifications.json +0 -32
  427. data/spec/fixtures/org_issues.json +0 -710
  428. data/spec/fixtures/organization-repositories.json +0 -4292
  429. data/spec/fixtures/organization-repository.json +0 -42
  430. data/spec/fixtures/organization.json +0 -18
  431. data/spec/fixtures/organization_events.json +0 -61
  432. data/spec/fixtures/organization_members.json +0 -576
  433. data/spec/fixtures/organization_public_events.json +0 -61
  434. data/spec/fixtures/organization_team_members.json +0 -16
  435. data/spec/fixtures/organization_team_repos.json +0 -62
  436. data/spec/fixtures/organizations.json +0 -44
  437. data/spec/fixtures/participation_stats.json +0 -110
  438. data/spec/fixtures/public_events.json +0 -1104
  439. data/spec/fixtures/public_gists.json +0 -968
  440. data/spec/fixtures/public_key.json +0 -5
  441. data/spec/fixtures/public_key_update.json +0 -5
  442. data/spec/fixtures/public_keys.json +0 -7
  443. data/spec/fixtures/pull_created.json +0 -138
  444. data/spec/fixtures/pull_request.json +0 -138
  445. data/spec/fixtures/pull_request_comment.json +0 -35
  446. data/spec/fixtures/pull_request_comment_create.json +0 -35
  447. data/spec/fixtures/pull_request_comment_reply.json +0 -35
  448. data/spec/fixtures/pull_request_comment_update.json +0 -35
  449. data/spec/fixtures/pull_request_comments.json +0 -35
  450. data/spec/fixtures/pull_request_commits.json +0 -45
  451. data/spec/fixtures/pull_request_files.json +0 -35
  452. data/spec/fixtures/pull_request_merged.json +0 -5
  453. data/spec/fixtures/pull_requests.json +0 -187
  454. data/spec/fixtures/pull_requests_comments.json +0 -82
  455. data/spec/fixtures/pull_update.json +0 -138
  456. data/spec/fixtures/punch_card_stats.json +0 -842
  457. data/spec/fixtures/readme.json +0 -14
  458. data/spec/fixtures/ref.json +0 -9
  459. data/spec/fixtures/ref_create.json +0 -29
  460. data/spec/fixtures/ref_update.json +0 -11
  461. data/spec/fixtures/refs.json +0 -38
  462. data/spec/fixtures/refs_tags.json +0 -29
  463. data/spec/fixtures/repo_assignees.json +0 -30
  464. data/spec/fixtures/repo_events.json +0 -1652
  465. data/spec/fixtures/repo_issues_events.json +0 -128
  466. data/spec/fixtures/repositories.json +0 -872
  467. data/spec/fixtures/repository.json +0 -34
  468. data/spec/fixtures/repository_issues_comments.json +0 -52
  469. data/spec/fixtures/repository_network_events.json +0 -155
  470. data/spec/fixtures/repository_notifications.json +0 -32
  471. data/spec/fixtures/say.txt +0 -22
  472. data/spec/fixtures/say_custom.txt +0 -22
  473. data/spec/fixtures/stargazers.json +0 -212
  474. data/spec/fixtures/starred.json +0 -1114
  475. data/spec/fixtures/starred_gists.json +0 -30
  476. data/spec/fixtures/status.json +0 -16
  477. data/spec/fixtures/statuses.json +0 -34
  478. data/spec/fixtures/subscribers.json +0 -9
  479. data/spec/fixtures/subscription.json +0 -8
  480. data/spec/fixtures/subscription_update.json +0 -8
  481. data/spec/fixtures/subscriptions.json +0 -39
  482. data/spec/fixtures/tag.json +0 -16
  483. data/spec/fixtures/tag_create.json +0 -16
  484. data/spec/fixtures/tags.json +0 -173
  485. data/spec/fixtures/team.json +0 -8
  486. data/spec/fixtures/teams.json +0 -12
  487. data/spec/fixtures/thread_subscription.json +0 -8
  488. data/spec/fixtures/thread_subscription_update.json +0 -8
  489. data/spec/fixtures/tree.json +0 -112
  490. data/spec/fixtures/tree_create.json +0 -14
  491. data/spec/fixtures/update_content.json +0 -44
  492. data/spec/fixtures/user_events.json +0 -101
  493. data/spec/fixtures/user_issues.json +0 -710
  494. data/spec/fixtures/user_performed_public_events.json +0 -78
  495. data/spec/fixtures/user_public_events.json +0 -78
  496. data/spec/fixtures/validation_failed.json +0 -11
  497. data/spec/fixtures/watched.json +0 -1022
  498. data/spec/fixtures/watchers.json +0 -182
  499. data/spec/octokit/client/github_spec.rb +0 -19
  500. data/spec/octokit/client/issue_events_spec.rb +0 -30
  501. data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +0 -48
  502. data/spec/octokit/client/pulls_spec.rb +0 -210
@@ -1,36 +1,22 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require 'helper'
3
2
 
4
3
  describe Octokit::Client::Say do
5
4
  before do
6
- @client = Octokit::Client.new
5
+ Octokit.reset!
6
+ @client = oauth_client
7
7
  end
8
8
 
9
- describe ".say" do
9
+ describe ".say", :vcr do
10
10
  it "returns an ASCII octocat" do
11
- stub_get("/octocat").
12
- to_return \
13
- :status => 200,
14
- :body => fixture("say.txt"),
15
- :headers => {
16
- :content_type => 'text/plain'
17
- }
18
-
19
11
  text = @client.say
20
- expect(text).to match(/Half measures/)
12
+ expect(text).to match /MMMMMMMMMMMMMMMMMMMMM/
13
+ assert_requested :get, github_url("/octocat")
21
14
  end
22
15
 
23
16
  it "returns an ASCII octocat with custom text" do
24
- stub_get("/octocat").
25
- to_return \
26
- :status => 200,
27
- :body => fixture("say_custom.txt"),
28
- :headers => {
29
- :content_type => 'text/plain'
30
- }
31
-
32
- text = @client.say
33
- expect(text).to match(/upset/)
17
+ text = @client.say "There is no need to be upset"
18
+ expect(text).to match /upset/
19
+ assert_requested :get, github_url("/octocat?s=There+is+no+need+to+be+upset")
34
20
  end
35
21
  end
36
22
 
@@ -0,0 +1,37 @@
1
+ require 'helper'
2
+
3
+ describe Octokit::Client::ServiceStatus do
4
+
5
+ before do
6
+ Octokit.reset!
7
+ end
8
+
9
+ describe ".github_status", :vcr do
10
+ it "returns the current system status" do
11
+ current_status = Octokit.github_status
12
+ expect(current_status.status).to_not be_nil
13
+ assert_requested :get, "https://status.github.com/api.json"
14
+ assert_requested :get, "https://status.github.com/api/status.json"
15
+ end
16
+ end # .github_status
17
+
18
+ describe ".github_status_last_message", :vcr do
19
+ it "returns the last human message" do
20
+ message = Octokit.github_status_last_message
21
+ expect(message.status).to_not be_nil
22
+ expect(message.body).to_not be_nil
23
+ assert_requested :get, "https://status.github.com/api.json"
24
+ assert_requested :get, "https://status.github.com/api/last-message.json"
25
+ end
26
+ end # .github_status_last_message
27
+
28
+ describe ".github_status", :vcr do
29
+ it "returns the most recent status messages" do
30
+ messages = Octokit.github_status_messages
31
+ expect(messages).to be_kind_of Array
32
+ assert_requested :get, "https://status.github.com/api.json"
33
+ assert_requested :get, "https://status.github.com/api/messages.json"
34
+ end
35
+ end # .github_status
36
+
37
+ end
@@ -1,55 +1,105 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require 'helper'
3
2
 
4
3
  describe Octokit::Client::Stats do
5
4
 
6
5
  before do
7
- @client = Octokit::Client.new(:login => 'sferik')
6
+ Octokit.reset!
7
+ @client = oauth_client
8
8
  end
9
9
 
10
- describe ".contributor_stats" do
11
- it "returns contributors and their contribution stats" do
12
- stub_get("/repos/pengwynn/octokit/stats/contributors").
13
- to_return(json_response("contributor_stats.json"))
14
- stats = @client.contributors_stats("pengwynn/octokit")
15
- expect(stats.first.author.login).to eq("pengwynn")
10
+ context "with cold graph cache" do
11
+
12
+ before do
13
+ VCR.turn_off!
14
+ stub_request(:any, /api\.github\.com\/repos\/octokit/).
15
+ to_return(:status => 202)
16
+ end
17
+
18
+ after do
19
+ VCR.turn_on!
16
20
  end
21
+
22
+ describe ".contributors_stats" do
23
+ it "returns contributors and their contribution stats" do
24
+ stats = @client.contributors_stats("octokit/octokit.rb")
25
+ expect(stats).to be_nil
26
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/contributors")
27
+ end
28
+ end # .contributors_stats
29
+
30
+ describe ".commit_activity_stats" do
31
+ it "returns the commit activity stats" do
32
+ stats = @client.commit_activity_stats("octokit/octokit.rb")
33
+ expect(stats).to be_nil
34
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/commit_activity")
35
+ end
36
+ end # .commit_activity_stats
37
+
38
+ describe ".code_frequency_stats" do
39
+ it "returns the code frequency stats" do
40
+ stats = @client.code_frequency_stats('octokit/octokit.rb')
41
+ expect(stats).to be_nil
42
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/code_frequency")
43
+ end
44
+ end # .code_frequency_stats
45
+
46
+ describe ".participation_stats" do
47
+ it "returns the owner and contributor participation stats" do
48
+ stats = @client.participation_stats('octokit/octokit.rb')
49
+ expect(stats).to be_nil
50
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/participation")
51
+ end
52
+ end # .participation_stats
53
+
54
+ describe ".punch_card_stats" do
55
+ it "returns commit count by hour punch card stats" do
56
+ stats = @client.punch_card_stats('octokit/octokit.rb')
57
+ expect(stats).to be_nil
58
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/punch_card")
59
+ end
60
+ end # .punch_card_stats
17
61
  end
18
62
 
19
- describe ".commit_activity_stats" do
63
+ describe ".contributors_stats", :vcr do
64
+ it "returns contributors and their contribution stats" do
65
+ stats = @client.contributors_stats("octokit/octokit.rb")
66
+ expect(stats).to be_kind_of Array
67
+ expect(stats.first.author.login).to_not be_nil
68
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/contributors")
69
+ end
70
+ end # .contributors_stats
71
+
72
+ describe ".commit_activity_stats", :vcr do
20
73
  it "returns the commit activity stats" do
21
- stub_get("/repos/pengwynn/octokit/stats/commit_activity").
22
- to_return(json_response("commit_activity_stats.json"))
23
- stats = @client.commit_activity_stats("pengwynn/octokit")
24
- expect(stats.first.week).to eq(1336867200)
74
+ stats = @client.commit_activity_stats("octokit/octokit.rb")
75
+ expect(stats).to be_kind_of Array
76
+ expect(stats.first.week).to be_kind_of Fixnum
77
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/commit_activity")
25
78
  end
26
- end
79
+ end # .commit_activity_stats
27
80
 
28
- describe ".code_frequency_stats" do
81
+ describe ".code_frequency_stats", :vcr do
29
82
  it "returns the code frequency stats" do
30
- stub_get("/repos/pengwynn/octokit/stats/code_frequency").
31
- to_return(json_response('code_frequency_stats.json'))
32
- stats = @client.code_frequency_stats('pengwynn/octokit')
33
- expect(stats.first.first).to eq(1260057600)
83
+ stats = @client.code_frequency_stats('octokit/octokit.rb')
84
+ expect(stats).to be_kind_of Array
85
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/code_frequency")
34
86
  end
35
- end
87
+ end # .code_frequency_stats
36
88
 
37
- describe ".participation_stats" do
89
+ describe ".participation_stats", :vcr do
38
90
  it "returns the owner and contributor participation stats" do
39
- stub_get("/repos/pengwynn/octokit/stats/participation").
40
- to_return(json_response('participation_stats.json'))
41
- stats = @client.participation_stats('pengwynn/octokit')
42
- expect(stats.owner.first).to eq(5)
91
+ stats = @client.participation_stats('octokit/octokit.rb')
92
+ expect(stats.fields).to include :owner
93
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/participation")
43
94
  end
44
- end
95
+ end # .participation_stats
45
96
 
46
- describe ".punch_card_stats" do
97
+ describe ".punch_card_stats", :vcr do
47
98
  it "returns commit count by hour punch card stats" do
48
- stub_get("/repos/pengwynn/octokit/stats/punch_card").
49
- to_return(json_response('punch_card_stats.json'))
50
- stats = @client.punch_card_stats('pengwynn/octokit')
51
- expect(stats.last.first).to eq(6)
99
+ stats = @client.punch_card_stats('octokit/octokit.rb')
100
+ expect(stats).to be_kind_of Array
101
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/stats/punch_card")
52
102
  end
53
- end
103
+ end # .punch_card_stats
54
104
 
55
105
  end
@@ -1,68 +1,28 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require 'helper'
3
2
 
4
3
  describe Octokit::Client::Statuses do
5
4
 
6
5
  before do
7
- @client = Octokit::Client.new(:login => 'sferik')
6
+ Octokit.reset!
7
+ @client = oauth_client
8
8
  end
9
9
 
10
- describe ".statuses" do
11
-
10
+ describe ".statuses", :vcr do
12
11
  it "lists commit statuses" do
13
- stub_get('https://api.github.com/repos/pengwynn/octokit/statuses/7d069dedd4cb56bf57760688657abd0e6b5a28b8').
14
- to_return(json_response('statuses.json'))
15
- statuses = @client.statuses('pengwynn/octokit', '7d069dedd4cb56bf57760688657abd0e6b5a28b8')
16
- expect(statuses.first.target_url).to eq('http://travis-ci.org/pengwynn/octokit/builds/2092930')
12
+ statuses = Octokit.statuses('octokit/octokit.rb', '7d069dedd4cb56bf57760688657abd0e6b5a28b8')
13
+ expect(statuses).to be_kind_of Array
14
+ assert_requested :get, github_url("/repos/octokit/octokit.rb/statuses/7d069dedd4cb56bf57760688657abd0e6b5a28b8")
17
15
  end
16
+ end # .statuses
18
17
 
19
- end
20
-
21
- describe ".create_status" do
22
-
18
+ describe ".create_status", :vcr do
23
19
  it "creates status" do
24
- stub_post('https://api.github.com/repos/pengwynn/octokit/statuses/7d069dedd4cb56bf57760688657abd0e6b5a28b8').
25
- to_return(json_response('status.json'))
26
20
  info = {
27
21
  :target_url => 'http://wynnnetherland.com'
28
22
  }
29
- status = @client.create_status('pengwynn/octokit', '7d069dedd4cb56bf57760688657abd0e6b5a28b8', 'success', info)
30
- expect(status.target_url).to eq('http://wynnnetherland.com')
23
+ @client.create_status("api-playground/api-sandbox", '78c9dcae41c7c5f81b012d15d06d843623a4988a', 'success', info)
24
+ assert_requested :post, github_url("/repos/api-playground/api-sandbox/statuses/78c9dcae41c7c5f81b012d15d06d843623a4988a")
31
25
  end
32
-
33
- end
34
-
35
- describe ".github_status" do
36
-
37
- it "returns the current system status" do
38
- stub_get('https://status.github.com/api/status.json').
39
- to_return(json_response('github_status.json'))
40
- github_status = @client.github_status
41
- expect(github_status.status).to eq('good')
42
- end
43
-
44
- end
45
-
46
- describe ".github_status_last_message" do
47
-
48
- it "returns the last human communication, status, and timestamp" do
49
- stub_get('https://status.github.com/api/last-message.json').
50
- to_return(json_response('github_status_last_message.json'))
51
- last_message = @client.github_status_last_message
52
- expect(last_message.body).to eq('Everything operating normally.')
53
- end
54
-
55
- end
56
-
57
- describe ".github_status_messages" do
58
-
59
- it "returns the most recent human communications" do
60
- stub_get('https://status.github.com/api/messages.json').
61
- to_return(json_response('github_status_messages.json'))
62
- status_messages = @client.github_status_messages
63
- expect(status_messages.first.body).to eq("I'm seeing, like, unicorns man.")
64
- end
65
-
66
- end
26
+ end # .create_status
67
27
 
68
28
  end
@@ -1,412 +1,208 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require 'helper'
3
2
 
4
3
  describe Octokit::Client::Users do
5
4
 
6
- before do
7
- @client = Octokit::Client.new(:login => 'sferik')
5
+ before(:each) do
6
+ Octokit.reset!
7
+ @client = oauth_client
8
8
  end
9
9
 
10
- describe ".search_users" do
11
-
12
- context "with a username passed" do
13
-
14
- it "returns matching username" do
15
- stub_get("https://api.github.com/legacy/user/search/sferik").
16
- to_return(json_response("legacy/users.json"))
17
- users = @client.search_users("sferik")
18
- expect(users.first.username).to eq("sferik")
19
- end
20
-
21
- end
22
-
23
- context "with no encode url" do
24
-
25
- it "should not raise URI::InvalidURIError and returns success" do
26
- stub_get("https://api.github.com/legacy/user/search/follower:>0").
27
- to_return(json_response("legacy/users.json"))
28
- users = @client.search_users("follower:>0")
29
- expect(users.first.login).to eq("sferik")
30
- end
31
-
32
- end
33
-
34
-
35
- end
36
-
37
- describe ".all_users" do
38
-
10
+ describe ".all_users", :vcr do
39
11
  it "returns all GitHub users" do
40
- stub_get("/users").
41
- to_return(json_response("all_users.json"))
42
- users = @client.all_users
43
- expect(users.first.login).to eq("mojombo")
44
- end
45
-
46
- end
47
-
48
- describe ".user" do
49
-
50
- context "with a username passed" do
51
-
52
- it "returns the user" do
53
- stub_get("/users/sferik").
54
- to_return(json_response("user.json"))
55
- user = @client.user("sferik")
56
- expect(user.login).to eq("sferik")
57
- end
58
-
12
+ users = Octokit.all_users
13
+ expect(users).to be_kind_of Array
59
14
  end
15
+ end # .all_users
60
16
 
61
- context "without a username passed" do
62
-
63
- it "returns the authenticated user" do
64
- stub_get("/user").
65
- to_return(json_response("user.json"))
66
- user = @client.user
67
- expect(user.login).to eq("sferik")
68
- end
69
-
17
+ describe ".user", :vcr do
18
+ it "returns a user" do
19
+ user = Octokit.client.user("sferik")
20
+ expect(user.login).to eq 'sferik'
70
21
  end
71
-
72
- end
73
-
74
- describe '.access_token' do
75
-
76
- context 'with authorization code, client id, and client secret' do
77
-
78
- it 'returns the access_token' do
79
- stub_post("https://github.com/login/oauth/access_token").
80
- to_return(json_response("user_token.json"))
81
- resp = @client.access_token('code', 'id_here', 'secret_here')
82
- expect(resp.access_token).to eq('this_be_ye_token/use_it_wisely')
83
- end
84
-
22
+ it "returns the authenticated user" do
23
+ user = @client.user
24
+ expect(user.login).to eq test_github_login
85
25
  end
26
+ end # .user
86
27
 
87
- end
88
-
89
- describe ".validate_credentials" do
28
+ describe ".validate_credentials", :vcr do
90
29
  it "validates username and password" do
91
- stub_get("https://sferik:foobar@api.github.com/user").
92
- to_return(json_response("user.json"))
93
-
94
- expect(Octokit.validate_credentials(:login => 'sferik', :password => 'foobar')).to eq(true)
30
+ expect(Octokit.validate_credentials(:login => test_github_login, :password => test_github_password)).to be_true
95
31
  end
96
- end
97
-
98
- describe ".update_user" do
99
-
100
- context "with a location passed" do
101
-
102
- it "updates the user's location" do
103
- stub_patch("/user").
104
- with(:body => {:name => "Erik Michaels-Ober", :email => "sferik@gmail.com", :company => "Code for America", :location => "San Francisco", :hireable => false}).
105
- to_return(json_response("user.json"))
106
- user = @client.update_user(:name => "Erik Michaels-Ober", :email => "sferik@gmail.com", :company => "Code for America", :location => "San Francisco", :hireable => false)
107
- expect(user.login).to eq("sferik")
108
- end
32
+ end # .validate_credentials
109
33
 
34
+ describe ".update_user", :vcr do
35
+ it "updates a user profile" do
36
+ user = @client.update_user(:location => "San Francisco, CA", :hireable => false)
37
+ expect(user.login).to eq test_github_login
38
+ assert_requested :patch, github_url("/user")
110
39
  end
40
+ end # .update_user
111
41
 
112
- end
113
-
114
- describe ".followers" do
115
-
116
- context "with a username passed" do
117
-
118
- it "returns the user's followers" do
119
- stub_get("https://api.github.com/users/sferik/followers").
120
- to_return(json_response("followers.json"))
121
- users = @client.followers("sferik")
122
- expect(users.first.login).to eq("puls")
123
- end
124
-
42
+ describe ".followers", :vcr do
43
+ it "returns followers for a user" do
44
+ users = Octokit.followers("sferik")
45
+ expect(users).to be_kind_of Array
46
+ assert_requested :get, github_url("/users/sferik/followers")
125
47
  end
126
-
127
- context "without a username passed" do
128
-
129
- it "returns the user's followers" do
130
- stub_get("https://api.github.com/users/sferik/followers").
131
- to_return(json_response("followers.json"))
132
- users = @client.followers
133
- expect(users.first.login).to eq("puls")
134
- end
135
-
48
+ it "returns the authenticated user's followers" do
49
+ users = @client.followers
50
+ expect(users).to be_kind_of Array
51
+ assert_requested :get, github_url("/users/#{test_github_login}/followers")
136
52
  end
53
+ end # .followers
137
54
 
138
- end
139
-
140
- describe ".following" do
141
-
142
- context "with a username passed" do
143
-
144
- it "returns the user's following" do
145
- stub_get("https://api.github.com/users/sferik/following").
146
- to_return(json_response("following.json"))
147
- users = @client.following("sferik")
148
- expect(users.first.login).to eq("rails")
149
- end
150
-
55
+ describe ".following", :vcr do
56
+ it "returns following for a user" do
57
+ users = Octokit.following("sferik")
58
+ expect(users).to be_kind_of Array
59
+ assert_requested :get, github_url("/users/sferik/following")
151
60
  end
152
-
153
- context "without a username passed" do
154
-
155
- it "returns the user's following" do
156
- stub_get("https://api.github.com/users/sferik/following").
157
- to_return(json_response("following.json"))
158
- users = @client.following
159
- expect(users.first.login).to eq("rails")
160
- end
161
-
162
- end
163
-
164
- end
165
-
166
- describe ".follows?" do
167
-
168
- context "with one user following another" do
169
-
170
- it "returns true" do
171
- stub_get("https://api.github.com/user/following/puls").
172
- to_return(:status => 204, :body => "")
173
- follows = @client.follows?("sferik", "puls")
174
- expect(follows).to eq(true)
175
- end
176
-
61
+ it "returns the authenticated user's following" do
62
+ users = @client.following
63
+ expect(users).to be_kind_of Array
64
+ assert_requested :get, github_url("/users/#{test_github_login}/following")
177
65
  end
66
+ end # .following
178
67
 
179
- context "with one user not following another" do
180
-
181
- it "returns false" do
182
- stub_get("https://api.github.com/user/following/dogbrainz").
183
- to_return(:status => 404, :body => "")
184
- follows = @client.follows?("sferik", "dogbrainz")
185
- expect(follows).to be_false
186
- end
187
-
68
+ describe ".follows?", :vcr do
69
+ it "checks if the authenticated user follows another" do
70
+ follows = @client.follows?("sferik")
71
+ assert_requested :get, github_url("/user/following/sferik")
188
72
  end
73
+ end # .follows?
189
74
 
190
- end
191
-
192
- describe ".follow" do
193
-
75
+ describe ".follow", :vcr do
194
76
  it "follows a user" do
195
- stub_put("https://api.github.com/user/following/dianakimball").
196
- to_return(:status => 204, :body => "")
197
- following = @client.follow("dianakimball")
198
- expect(following).to eq(true)
77
+ following = @client.follow("pengwynn")
78
+ assert_requested :put, github_url("/user/following/pengwynn")
199
79
  end
80
+ end # .follow
200
81
 
201
- end
202
-
203
- describe ".unfollow" do
204
-
82
+ describe ".unfollow", :vcr do
205
83
  it "unfollows a user" do
206
- stub_delete("https://api.github.com/user/following/dogbrainz").
207
- to_return(:status => 204, :body => "")
208
- following = @client.unfollow("dogbrainz")
209
- expect(following).to eq(true)
84
+ following = @client.unfollow("pengwynn")
85
+ assert_requested :delete, github_url("/user/following/pengwynn")
210
86
  end
87
+ end # .unfollow
211
88
 
212
- end
213
-
214
- describe ".starred?" do
215
-
216
- context "with on user starring a repo" do
217
-
218
- it "returns true" do
219
- stub_get("https://api.github.com/user/starred/sferik/rails_admin").
220
- to_return(:status => 204, :body => "")
221
- starred = @client.starred?("sferik", "rails_admin")
222
- expect(starred).to eq(true)
223
- end
224
-
89
+ describe ".starred?", :vcr do
90
+ it "checks if the authenticated user has starred a repository" do
91
+ starred = @client.starred?("sferik", "rails_admin")
92
+ assert_requested :get, github_url("/user/starred/sferik/rails_admin")
225
93
  end
94
+ end # .starred?
226
95
 
227
- context "with on user not starring a repo" do
228
-
229
- it "returns false" do
230
- stub_get("https://api.github.com/user/starred/sferik/dogbrainz").
231
- to_return(:status => 404, :body => "")
232
- starred = @client.starred?("sferik", "dogbrainz")
233
- expect(starred).to be_false
234
- end
235
-
236
- end
237
-
238
- end
239
-
240
- describe ".starred" do
241
-
242
- context "with a username passed" do
243
-
244
- it "returns starred repositories" do
245
- stub_get("https://api.github.com/users/sferik/starred").
246
- to_return(json_response("starred.json"))
247
- repositories = @client.starred("sferik")
248
- expect(repositories.first.name).to eq("grit")
249
- end
250
-
251
- end
252
-
253
- context "without a username passed" do
254
-
255
- it "returns starred repositories" do
256
- stub_get("https://api.github.com/users/sferik/starred").
257
- to_return(json_response("starred.json"))
258
- repositories = @client.starred
259
- expect(repositories.first.name).to eq("grit")
260
- end
261
-
262
- end
263
-
264
- end
265
-
266
- describe ".watched" do
267
-
268
- context "with a username passed" do
269
-
270
- it "returns watched repositories" do
271
- stub_get("https://api.github.com/users/sferik/watched").
272
- to_return(json_response("watched.json"))
273
- repositories = @client.watched("sferik")
274
- expect(repositories.first.name).to eq("grit")
275
- end
276
-
277
- end
278
-
279
- context "without a username passed" do
280
-
281
- it "returns watched repositories" do
282
- stub_get("https://api.github.com/users/sferik/watched").
283
- to_return(json_response("watched.json"))
284
- repositories = @client.watched
285
- expect(repositories.first.name).to eq("grit")
286
- end
287
-
96
+ describe ".starred", :vcr do
97
+ it "returns starred repositories for a user" do
98
+ repositories = Octokit.starred("sferik")
99
+ assert_requested :get, github_url("/users/sferik/starred")
288
100
  end
289
-
290
- end
291
-
292
- describe ".key" do
293
-
294
- it "returns a public key" do
295
- stub_get("https://api.github.com/user/keys/103205").
296
- to_return(json_response('public_key.json'))
297
- public_key = @client.key(103205)
298
- expect(public_key.id).to eq(103205)
299
- expect(public_key[:key]).to include("ssh-dss AAAAB")
101
+ it "returns starred repositories for the authenticated user" do
102
+ repositories = @client.starred
103
+ assert_requested :get, github_url("/user/starred")
300
104
  end
105
+ end # .starred
301
106
 
302
- end
303
-
304
- describe ".keys" do
305
-
306
- it "returns public keys" do
307
- stub_get("https://api.github.com/user/keys").
308
- to_return(json_response("public_keys.json"))
107
+ describe ".keys", :vcr do
108
+ it "returns public keys for the authenticated user" do
309
109
  public_keys = @client.keys
310
- expect(public_keys.first.id).to eq(103205)
110
+ expect(public_keys).to be_kind_of Array
111
+ assert_requested :get, github_url("/user/keys")
311
112
  end
113
+ end # .keys
312
114
 
313
- end
314
-
315
- describe ".user_keys" do
316
-
317
- it "returns public keys for a user" do
318
- stub_get("https://api.github.com/users/pengwynn/keys").
319
- to_return(json_response("public_keys.json"))
320
- public_keys = @client.user_keys 'pengwynn'
321
- expect(public_keys.first.id).to eq(103205)
115
+ describe ".user_keys", :vcr do
116
+ it "returns public keys for another user" do
117
+ public_keys = Octokit.user_keys("pengwynn")
118
+ expect(public_keys).to be_kind_of Array
119
+ assert_requested :get, github_url("/users/pengwynn/keys")
322
120
  end
121
+ end # .user_keys
323
122
 
324
- end
325
-
326
- describe ".add_key" do
123
+ context "methods requiring an existing @public_key", :vcr do
327
124
 
328
- it "adds a public key" do
329
- title, key = "Moss", "ssh-dss AAAAB3NzaC1kc3MAAACBAJz7HanBa18ad1YsdFzHO5Wy1/WgXd4BV+czbKq7q23jungbfjN3eo2a0SVdxux8GG+RZ9ia90VD/X+PE4s3LV60oXZ7PDAuyPO1CTF0TaDoKf9mPaHcPa6agMJVocMsgBgwviWT1Q9VgN1SccDsYVDtxkIAwuw25YeHZlG6myx1AAAAFQCgW+OvXWUdUJPBGkRJ8ML7uf0VHQAAAIAlP5G96tTss0SKYVSCJCyocn9cyGQdNjxah4/aYuYFTbLI1rxk7sr/AkZfJNIoF2UFyO5STbbratykIQGUPdUBg1a2t72bu31x+4ZYJMngNsG/AkZ2oqLiH6dJKHD7PFx2oSPalogwsUV7iSMIZIYaPa03A9763iFsN0qJjaed+gAAAIBxz3Prxdzt/os4XGXSMNoWcS03AFC/05NOkoDMrXxQnTTpp1wrOgyRqEnKz15qC5dWk1ynzK+LJXHDZGA8lXPfCjHpJO3zrlZ/ivvLhgPdDpt13MAhIJFH06hTal0woxbk/fIdY71P3kbgXC0Ppx/0S7BC+VxqRCA4/wcM+BoDbA== host"
330
- stub_post("https://api.github.com/user/keys").
331
- with(:title => title, :key => key).
332
- to_return(json_response("public_key.json"))
333
- public_key = @client.add_key(title, key)
334
- expect(public_key.id).to eq(103205)
125
+ before(:each) do
126
+ title, key = "wynning", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN/h7Hf5TA6G4p19deF8YS9COfuBd133GPs49tO6AU/DKIt7tlitbnUnttT0VbNZM4fplyinPu5vJl60eusn/Ngq2vDfSHP5SfgHfA9H8cnHGPYG7w6F0CujFB3tjBhHa3L6Je50E3NC4+BGGhZMpUoTClEI5yEzx3qosRfpfJu/2MUp/V2aARCAiHUlUoj5eiB15zC25uDsY7SYxkh1JO0ecKSMISc/OCdg0kwi7it4t7S/qm8Wh9pVGuA5FmVk8w0hvL+hHWB9GT02WPqiesMaS9Sj3t0yuRwgwzLDaudQPKKTKYXi+SjwXxTJ/lei2bZTMC4QxYbqfqYQt66pQB wynn.netherland+api-padawan@gmail.com"
127
+ @public_key = @client.add_key(title, key)
335
128
  end
336
129
 
337
- end
338
-
339
- describe ".update_key" do
340
-
341
- it "updates a public key" do
342
- updated_key = {
343
- :title => "updated title",
344
- :key => "ssh-rsa BBBB..."
345
- }
346
- stub_patch("https://api.github.com/user/keys/1").
347
- with(updated_key).
348
- to_return(json_response("public_key_update.json"))
349
- public_key = @client.update_key(1, updated_key)
350
- expect(public_key[:title]).to eq(updated_key[:title])
351
- expect(public_key[:key]).to eq(updated_key[:key])
130
+ after(:each) do
131
+ @client.remove_key(@public_key.id)
352
132
  end
353
133
 
354
- end
355
-
356
- describe ".remove_key" do
134
+ describe ".add_key" do
135
+ it "adds a public key" do
136
+ assert_requested :post, github_url("/user/keys")
137
+ end
138
+ end # .add_key
357
139
 
358
- it "removes a public key" do
359
- stub_delete("https://api.github.com/user/keys/103205").
360
- to_return(:status => 204, :body => "")
361
- response = @client.remove_key(103205)
362
- expect(response).to eq(true)
140
+ describe ".key" do
141
+ it "returns a public key" do
142
+ key = @client.key @public_key.id
143
+ assert_requested :get, github_url("/user/keys/#{@public_key.id}")
144
+ end
363
145
  end
364
146
 
365
- end
147
+ describe ".update_key" do
148
+ it "updates a public key" do
149
+ public_key = @client.update_key(@public_key.id, :title => 'Updated key')
150
+ assert_requested :patch, github_url("/user/keys/#{@public_key.id}")
151
+ end
152
+ end # .update_key
153
+
154
+ describe ".remove_key" do
155
+ it "removes a public key" do
156
+ response = @client.remove_key(@public_key.id)
157
+ assert_requested :delete, github_url("/user/keys/#{@public_key.id}")
158
+ end
159
+ end # .remove_key
366
160
 
367
- describe ".emails" do
161
+ end # @public_key methods
368
162
 
163
+ describe ".emails", :vcr do
369
164
  it "returns email addresses" do
370
- stub_get("https://api.github.com/user/emails").
371
- to_return(json_response("emails.json"))
372
165
  emails = @client.emails
373
- expect(emails.first).to eq("sferik@gmail.com")
166
+ expect(emails).to be_kind_of Array
167
+ assert_requested :get, github_url("/user/emails")
374
168
  end
169
+ end # .emails
375
170
 
376
- end
377
-
378
- describe ".add_email" do
379
-
171
+ describe ".add_email", :vcr do
380
172
  it "adds an email address" do
381
- stub_post("https://api.github.com/user/emails").
382
- with(:email => "sferik@gmail.com").
383
- to_return(json_response("emails.json"))
384
- emails = @client.add_email("sferik@gmail.com")
385
- expect(emails.first).to eq("sferik@gmail.com")
173
+ emails = @client.add_email("wynn.netherland+apitest@gmail.com")
174
+ assert_requested :post, github_url("/user/emails")
386
175
  end
176
+ end # .add_email
387
177
 
388
- end
389
-
390
- describe ".remove_email" do
391
-
178
+ describe ".remove_email", :vcr do
392
179
  it "removes an email address" do
393
- stub_delete("https://api.github.com/user/emails?email=sferik@gmail.com").
394
- to_return(:status => 204, :body => "")
395
- response = @client.remove_email("sferik@gmail.com")
396
- expect(response).to eq(true)
180
+ emails = @client.remove_email("wynn.netherland+apitest@gmail.com")
181
+ assert_requested :delete, github_url("/user/emails")
397
182
  end
183
+ end # .remove_email
398
184
 
399
- end
400
-
401
- describe ".subscriptions" do
402
-
403
- it "returns the repositories the user watches for notifications" do
404
- stub_get("https://api.github.com/users/pengwynn/subscriptions").
405
- to_return(json_response("subscriptions.json"))
406
- subscriptions = @client.subscriptions("pengwynn")
407
- expect(subscriptions.first.id).to eq(11560)
408
- expect(subscriptions.first.name).to eq("ujs_sort_helper")
185
+ describe ".subscriptions", :vcr do
186
+ it "returns the repositories a user watches for notifications" do
187
+ subscriptions = Octokit.subscriptions("pengwynn")
188
+ assert_requested :get, github_url("/users/pengwynn/subscriptions")
409
189
  end
410
- end
190
+ it "returns the repositories the authenticated user watches for notifications" do
191
+ subscriptions = @client.subscriptions
192
+ assert_requested :get, github_url("/user/subscriptions")
193
+ end
194
+ end # .subscriptions
195
+
196
+ describe '.access_token' do
197
+ it 'returns the access_token' do
198
+ VCR.turn_off!
199
+ stub_post("https://github.com/login/oauth/access_token").
200
+ to_return(json_response("web_flow_token.json"))
201
+ response = Octokit.exchange_code_for_token('code', 'id_here', 'secret_here')
202
+ expect(response.access_token).to eq 'this_be_ye_token/use_it_wisely'
203
+ assert_requested :post, "https://github.com/login/oauth/access_token"
204
+ VCR.turn_on!
205
+ end
206
+ end # .access_token
411
207
 
412
208
  end