From be851a573a124cab2f45e247df5ccfb39300b70f Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Wed, 8 Oct 2014 11:31:00 -0400 Subject: [PATCH 1/2] remove preview API warning for team memberships API --- lib/octokit/client/organizations.rb | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/lib/octokit/client/organizations.rb b/lib/octokit/client/organizations.rb index 98a41b670..f0a6fd93c 100644 --- a/lib/octokit/client/organizations.rb +++ b/lib/octokit/client/organizations.rb @@ -498,7 +498,6 @@ def user_teams(options = {}) # @example Check if a user has a membership for a team # @client.team_membership(1234, 'pengwynn') def team_membership(team_id, user, options = {}) - options = ensure_org_invitations_api_media_type(options) get "teams/#{team_id}/memberships/#{user}", options end @@ -514,7 +513,6 @@ def team_membership(team_id, user, options = {}) # @example Check if a user has a membership for a team # @client.add_team_membership(1234, 'pengwynn') def add_team_membership(team_id, user, options = {}) - options = ensure_org_invitations_api_media_type(options) put "teams/#{team_id}/memberships/#{user}", options end @@ -527,7 +525,6 @@ def add_team_membership(team_id, user, options = {}) # @example # @client.remove_team_membership(100000, 'pengwynn') def remove_team_membership(team_id, user, options = {}) - options = ensure_org_invitations_api_media_type(options) boolean_from_response :delete, "teams/#{team_id}/memberships/#{user}", options end @@ -536,7 +533,6 @@ def remove_team_membership(team_id, user, options = {}) # @return [Array] Array of organizations memberships. # @see https://developer.github.com/v3/orgs/members/#list-your-organization-memberships def organization_memberships(options = {}) - options = ensure_org_invitations_api_media_type(options) paginate "user/memberships/orgs", options end alias :org_memberships :organization_memberships @@ -547,7 +543,6 @@ def organization_memberships(options = {}) # @return [Sawyer::Resource] Hash representing the organization membership. # @see https://developer.github.com/v3/orgs/members/#get-your-organization-membership def organization_membership(org, options = {}) - options = ensure_org_invitations_api_media_type(options) get "user/memberships/orgs/#{org}", options end alias :org_membership :organization_membership @@ -559,29 +554,9 @@ def organization_membership(org, options = {}) # @return [Sawyer::Resource] Hash representing the updated organization membership. # @see https://developer.github.com/v3/orgs/members/#edit-your-organization-membership def update_organization_membership(org, options = {}) - options = ensure_org_invitations_api_media_type(options) patch "user/memberships/orgs/#{org}", options end alias :update_org_membership :update_organization_membership - - private - - def ensure_org_invitations_api_media_type(options = {}) - if options[:accept].nil? - options[:accept] = ORG_INVITATIONS_PREVIEW_MEDIA_TYPE - warn_org_invitations_preview - end - - options - end - - def warn_org_invitations_preview - octokit_warn \ - "WARNING: The preview version of the Organization Team Memberships API " \ - "is not yet suitable for production use. You can avoid this message by " \ - "supplying an appropriate media type in the 'Accept' request header. " \ - "See the blog post for details: http://git.io/a9jglQ" - end end end end From 7242f22de4bc2e4a837231b451a4d0ee057150ee Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Wed, 8 Oct 2014 11:41:45 -0400 Subject: [PATCH 2/2] remove unused constant --- lib/octokit/client/organizations.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/octokit/client/organizations.rb b/lib/octokit/client/organizations.rb index f0a6fd93c..69bb6a028 100644 --- a/lib/octokit/client/organizations.rb +++ b/lib/octokit/client/organizations.rb @@ -6,8 +6,6 @@ class Client # @see https://developer.github.com/v3/orgs/ module Organizations - ORG_INVITATIONS_PREVIEW_MEDIA_TYPE = "application/vnd.github.the-wasp-preview+json".freeze - # Get an organization # # @param org [String, Integer] Organization GitHub login or id.