Sha256: d1e70d735cfd5f2d236c90096e2c8aaf43072c40be601547943a7209390570f2

Contents?: true

Size: 666 Bytes

Versions: 10

Compression:

Stored size: 666 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, option={})
    response = self.post("/1/lists/create.json", {:name => name}.update(option))
    return List.new(response, @access_token)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pupil-0.6.2 lib/pupil/lists.rb
pupil-0.6.1 lib/pupil/lists.rb
pupil-0.6 lib/pupil/lists.rb
pupil-0.5 lib/pupil/lists.rb
pupil-0.4.1 lib/pupil/lists.rb
pupil-0.4 lib/pupil/lists.rb
pupil-0.3.3 lib/pupil/lists.rb
pupil-0.3.2 lib/pupil/lists.rb
pupil-0.3.1 lib/pupil/lists.rb
pupil-0.3.0 lib/pupil/lists.rb