Sha256: 633f167306af51bf36f8824b267eb0b9cfcc90515a7946415ca9a5f1a580e065

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

class Pupil
  # @param [Fixnum] id id
  # @return [Pupil::User] response
  def block(param)
    response = self.post("blocks/create.json", {guess_parameter(param) => param})
    
    if response.class == Hash && response["id"]
      return User.new response
    end
    return false
  end

  # @param [Fixnum] id id
  # @return [Pupil::User] response
  def unblock(param)
    response = self.post("blocks/destroy.json", {guess_parameter(param) => param})
    
    if response.class == Hash && response["id"]
      return User.new response
    end
    return false
  end

  # @return [Array] list of blocking users
  def blocking
    response = self.get("blocks/list.json")
    return [] if response["nilclasses"]
    users = Array.new
    response["users"].each do |element|
      user = User.new element
      users << user
    end
    return users
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pupil-0.7 lib/pupil/blocks.rb