Sha256: 1e0940738ff976c6ed06a51b89da54353debad5434476229ff4ce9d42b5884e6

Contents?: true

Size: 664 Bytes

Versions: 3

Compression:

Stored size: 664 Bytes

Contents

class Pupil
  # @return [Hash] lists
  def lists(param={})
    if param[:contains]
      response = self.get("/1/lists/memberships.json", param.reject{|p|p==:contains}.update(guess_parameter(param[:contains]) => param[:contains]))
      response = response["lists"]
    else
      response = self.get("/1/lists/all.json", param)
    end
    return [] unless response
    lists = Array.new
    response.each do |list|
      lists << List.new(list, @access_token)
    end
    return lists
  end
  
  def create_list(name, param={})
    response = self.post("/1/lists/create.json", {:name => name}.update(param))
    return List.new(response, @access_token)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pupil-0.2.2 lib/pupil/lists.rb
pupil-0.2.1 lib/pupil/lists.rb
pupil-0.2.0 lib/pupil/lists.rb