diff --git a/lib/octokit/client/organizations.rb b/lib/octokit/client/organizations.rb index 98a41b670..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. @@ -498,7 +496,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 +511,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 +523,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 +531,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 +541,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 +552,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