Module: Springpad

Defined in:
lib/springpad.rb,
lib/springpad/api.rb,
lib/springpad/cli.rb,
lib/springpad/blocks.rb,
lib/springpad/version.rb,
lib/springpad/blocks/note.rb,
lib/springpad/blocks/task.rb

Defined Under Namespace

Modules: Blocks Classes: API, CLI

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.add(type, options) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/springpad.rb', line 26

def self.add(type, options)
  cli = Springpad::CLI.new
  options = {}
  options.merge({:public => false}) if options[:private]
  contents = cli.edit

  api = Springpad::API.new
  case type
  when "note"
    p api.add_note(contents, options)
  when "task"
    p api.add_task(contents, options)
  end
end

.list(type, options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/springpad.rb', line 7

def self.list(type, options)
  api = Springpad::API.new
  options = {}
  options.merge({:public => false}) if options[:private]
  case type
  when "note"
    render api.notes(options)
  when "task"
    render api.tasks(options)
  end
end

.render(elements) ⇒ Object



19
20
21
22
23
24
# File 'lib/springpad.rb', line 19

def self.render(elements)
  elements.each do |element|
    element.render
    puts
  end
end