Skip to content

Commit

Permalink
Merge pull request octokit#1255 from octokit/update-org-paths
Browse files Browse the repository at this point in the history
Update org paths to use Organization.path
  • Loading branch information
Heather Harvey authored May 21, 2020
2 parents 9560329 + 10d1e15 commit 266acbf
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/octokit/client/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ def organization_membership(org, options = {})

# Edit an organization membership
#
# @param org [String] Organization GitHub login.
# @param org [String, Integer] Organization GitHub login or id.
# @option options [String] :role The role of the user in the organization.
# @option options [String] :state The state that the membership should be in.
# @option options [String] :user The login of the user, otherwise authenticated user.
Expand All @@ -701,7 +701,7 @@ def update_organization_membership(org, options = {})
options = options.dup
if user = options.delete(:user)
options.delete(:state)
put "orgs/#{org}/memberships/#{user}", options
put "#{Organization.path(org)}/memberships/#{user}", options
else
options.delete(:role)
patch "user/memberships/orgs/#{org}", options
Expand All @@ -711,13 +711,13 @@ def update_organization_membership(org, options = {})

# Remove an organization membership
#
# @param org [String] Organization GitHub login.
# @param org [String, Integer] Organization GitHub login or id.
# @return [Boolean] Success
# @see https://developer.github.com/v3/orgs/members/#remove-organization-membership
def remove_organization_membership(org, options = {})
options = options.dup
user = options.delete(:user)
user && boolean_from_response(:delete, "orgs/#{org}/memberships/#{user}", options)
user && boolean_from_response(:delete, "#{Organization.path(org)}/memberships/#{user}", options)
end
alias :remove_org_membership :remove_organization_membership

Expand All @@ -735,7 +735,7 @@ def remove_organization_membership(org, options = {})
def start_migration(org, repositories, options = {})
options = ensure_api_media_type(:migrations, options)
options[:repositories] = repositories
post "orgs/#{org}/migrations", options
post "#{Organization.path(org)}/migrations", options
end

# Lists the most recent migrations.
Expand All @@ -747,7 +747,7 @@ def start_migration(org, repositories, options = {})
# @see https://developer.github.com/v3/orgs/migrations/#get-a-list-of-migrations
def migrations(org, options = {})
options = ensure_api_media_type(:migrations, options)
paginate "orgs/#{org}/migrations", options
paginate "#{Organization.path(org)}/migrations", options
end

# Fetches the status of a migration.
Expand All @@ -759,7 +759,7 @@ def migrations(org, options = {})
# @see https://developer.github.com/v3/orgs/migrations/#get-the-status-of-a-migration
def migration_status(org, id, options = {})
options = ensure_api_media_type(:migrations, options)
get "orgs/#{org}/migrations/#{id}", options
get "#{Organization.path(org)}/migrations/#{id}", options
end

# Fetches the URL to a migration archive.
Expand All @@ -771,7 +771,7 @@ def migration_status(org, id, options = {})
# @see https://developer.github.com/v3/orgs/migrations/#download-a-migration-archive
def migration_archive_url(org, id, options = {})
options = ensure_api_media_type(:migrations, options)
url = "orgs/#{org}/migrations/#{id}/archive"
url = "#{Organization.path(org)}/migrations/#{id}/archive"

response = client_without_redirects(options).get(url)
response.headers['location']
Expand All @@ -786,7 +786,7 @@ def migration_archive_url(org, id, options = {})
# @see https://developer.github.com/v3/orgs/migrations/#delete-a-migration-archive
def delete_migration_archive(org, id, options = {})
options = ensure_api_media_type(:migrations, options)
delete "orgs/#{org}/migrations/#{id}/archive", options
delete "#{Organization.path(org)}/migrations/#{id}/archive", options
end

# Unlock a previous migration archive.
Expand All @@ -799,7 +799,7 @@ def delete_migration_archive(org, id, options = {})
# @see https://developer.github.com/v3/orgs/migrations/#unlock-a-repository
def unlock_repository(org, id, repo, options = {})
options = ensure_api_media_type(:migrations, options)
delete "orgs/#{org}/migrations/#{id}/repos/#{repo}/lock", options
delete "#{Organization.path(org)}/migrations/#{id}/repos/#{repo}/lock", options
end
end
end
Expand Down

0 comments on commit 266acbf

Please sign in to comment.