<commit_before>class Api::V1::OwnersController < Api::BaseController

  skip_before_filter :verify_authenticity_token, :only => [:create, :destroy]

  before_filter :authenticate_with_api_key
  before_filter :verify_authenticated_user
  before_filter :find_rubygem
  before_filter :verify_gem_ownership

  def show
    respond_to do |format|
      format.any(:json, :all) { render :json => @rubygem.owners }
      format.yaml { render :text => @rubygem.owners.to_yaml }
    end
  end

  def create
    if owner = User.find_by_email(params[:email])
      @rubygem.ownerships.create(:user => owner, :approved => true)
      render :json => 'Owner added successfully.'
    else
      render :json => 'Owner could not be found.', :status => :not_found
    end
  end

  def destroy
    if owner = @rubygem.owners.find_by_email(params[:email])
      if @rubygem.ownerships.find_by_user_id(owner.id).try(:destroy)
        render :json => "Owner removed successfully."
      else
        render :json => 'Unable to remove owner.', :status => :forbidden
      end
    else
      render :json => 'Owner could not be found.', :status => :not_found
    end<commit_msg>map to_json for owners since that actually works<commit_after>class Api::V1::OwnersController < Api::BaseController

  skip_before_filter :verify_authenticity_token, :only => [:create, :destroy]

  before_filter :authenticate_with_api_key
  before_filter :verify_authenticated_user
  before_filter :find_rubygem
  before_filter :verify_gem_ownership

  def show
    respond_to do |format|
      format.any(:json, :all) { render :text => @rubygem.owners.map(&:to_json) }
      format.yaml { render :text => @rubygem.owners.to_yaml }
    end
  end

  def create
    if owner = User.find_by_email(params[:email])
      @rubygem.ownerships.create(:user => owner, :approved => true)
      render :json => 'Owner added successfully.'
    else
      render :json => 'Owner could not be found.', :status => :not_found
    end
  end

  def destroy
    if owner = @rubygem.owners.find_by_email(params[:email])
      if @rubygem.ownerships.find_by_user_id(owner.id).try(:destroy)
        render :json => "Owner removed successfully."
      else
        render :json => 'Unable to remove owner.', :status => :forbidden
      end
    else
      render :json => 'Owner could not be found.', :status => :not_found
    end
{'fraction_non_alphanumeric': 0.1130397967823878, 'fraction_numerical': 0.000846740050804403, 'mean_word_length': 3.5355086372360844, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5097098', 'n_tokens_mistral': 750, 'n_tokens_neox': 737, 'n_words': 188}