<commit_before>class Podio::Space < ActivePodio::Base
  property :space_id, :integer
  property :name, :string
  property :url, :string
  property :url_label, :string
  property :org_id, :integer
  property :contact_count, :integer
  property :members, :integer
  property :role, :string
  property :rights, :array
  property :post_on_new_app, :bool
  property :post_on_new_member, :bool
  
  has_one :created_by, :class => 'ByLine'

  alias_method :id, :space_id
  
  def create
    response = Space.create(:org_id => org_id, :name => name)
    self.url = response['url']
    self.space_id = response['space_id']
  end
  
  def update
    self.class.update(self.space_id, :name => self.name, :post_on_new_app => self.post_on_new_app, :post_on_new_member => self.post_on_new_member)
  end
  
  class << self
    def create(attributes)
      response = Podio.connection.post do |req|
        req.url '/space/'
        req.body = attributes
      end

      response.body
    end

    def update(space_id, attributes)
      Podio.connection.put("/space/#{space_id}", attributes).status
    end

    def find(id)
      member Podio.connection.get("/space/#{id}").body
    end

    def find_by_url(url)
      member Podio.connection.get("/space/url?url=#{ERB::Util.url_encode(url)}").body
    end
    
    def find_all_for_org(org_id)
      list Podio.connection.get("/org/#{org_id}/space/").body
    end
  end
end

<commit_msg>Add delete method to space<commit_after>class Podio::Space < ActivePodio::Base
  property :space_id, :integer
  property :name, :string
  property :url, :string
  property :url_label, :string
  property :org_id, :integer
  property :contact_count, :integer
  property :members, :integer
  property :role, :string
  property :rights, :array
  property :post_on_new_app, :bool
  property :post_on_new_member, :bool
  
  has_one :created_by, :class => 'ByLine'

  alias_method :id, :space_id
  
  def create
    response = Space.create(:org_id => org_id, :name => name)
    self.url = response['url']
    self.space_id = response['space_id']
  end
  
  def update
    self.class.update(self.space_id, :name => self.name, :post_on_new_app => self.post_on_new_app, :post_on_new_member => self.post_on_new_member)
  end
  
  class << self
    def create(attributes)
      response = Podio.connection.post do |req|
        req.url '/space/'
        req.body = attributes
      end

      response.body
    end

    def update(space_id, attributes)
      Podio.connection.put("/space/#{space_id}", attributes).status
    end

    def delete(id)
      Podio.connection.delete("/space/#{id}").status
    end

    def find(id)
      member Podio.connection.get("/space/#{id}").body
    end

    def find_by_url(url)
      member Podio.connection.get("/space/url?url=#{ERB::Util.url_encode(url)}").body
    end
    
    def find_all_for_org(org_id)
      list Podio.connection.get("/org/#{org_id}/space/").body
    end
  end
end


{'fraction_non_alphanumeric': 0.1257647858599592, 'fraction_numerical': 0.0, 'mean_word_length': 3.2714078374455733, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '5077483', 'n_tokens_mistral': 1016, 'n_tokens_neox': 1001, 'n_words': 214}