<commit_before># Encapsulates a user's membership of a space.
class Podio::SpaceMember < ActivePodio::Base
  property :role, :string
  property :invited_on, :datetime
  property :started_on, :datetime
  property :ended_on, :datetime

  has_one :user, :class => 'User'
  has_one :space, :class => 'Space'

  delegate :user_id, :name, :to => :user

  alias_method :id, :user_id

  class << self
    def find_all_for_role(space_id, role)
      list Podio.connection.get { |req|
        req.url("/space/#{space_id}/member/#{role}/")
      }.body
    end

    def find_membership(space_id, user_id)
      response = Podio.connection.get { |req|
        req.url("/space/#{space_id}/member/#{user_id}")
      }
      response.body
    end

    def find_all_ended(space_id)
      list Podio.connection.get { |req|
        req.url("/space/#{space_id}/member/ended/")
      }.body
    end

    def update_role(space_id, user_id, role)
      response = Podio.connection.put do |req|
        req.url "/space/#{space_id}/member/#{user_id}"
        req.body = { :role => role.to_s }
      end<commit_msg>added method to find all members of a space<commit_after># Encapsulates a user's membership of a space.
class Podio::SpaceMember < ActivePodio::Base
  property :role, :string
  property :invited_on, :datetime
  property :started_on, :datetime
  property :ended_on, :datetime

  has_one :user, :class => 'User'
  has_one :space, :class => 'Space'

  delegate :user_id, :name, :to => :user

  alias_method :id, :user_id

  class << self
    def find_all_for_role(space_id, role)
      list Podio.connection.get { |req|
        req.url("/space/#{space_id}/member/#{role}/")
      }.body
    end

    def find_membership(space_id, user_id)
      response = Podio.connection.get { |req|
        req.url("/space/#{space_id}/member/#{user_id}")
      }
      response.body
    end

    def find_all_ended(space_id)
      list Podio.connection.get { |req|
        req.url("/space/#{space_id}/member/ended/")
      }.body
    end

    def find_all(space_id)
      list Podio.connection.get { |req|
        req.url("/space/#{space_id}/member/")
      }.body
    end

    def update_role(space_id, user_id, role)
      response = Podio.connection.put do |req|
        req.url "/space/#{space_id}/member/#{user_id}"
        req.body = { :role => role.to_s }
      end
{'fraction_non_alphanumeric': 0.14029850746268657, 'fraction_numerical': 0.0, 'mean_word_length': 2.8396072013093288, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '4647119', 'n_tokens_mistral': 822, 'n_tokens_neox': 799, 'n_words': 177}