Module: ScratchPaper

Defined in:
lib/scratchpaper.rb,
lib/scratchpaper/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.scratch_note(type, message) ⇒ Object



7
8
9
10
11
12
# File 'lib/scratchpaper.rb', line 7

def scratch_note(type, message)
  RestClient.post("http://#{ENV["SCRATCHPAPER_URL"]}/#{ENV["SCRATCHPAPER_KEY"]}",
                  :data => [type, message].to_json)

  :ok
end

.sl(data) ⇒ Object



22
23
24
# File 'lib/scratchpaper.rb', line 22

def sl(data)
  scratch_note("list", data)
end

.sp(data) ⇒ Object



14
15
16
# File 'lib/scratchpaper.rb', line 14

def sp(data)
  scratch_note("text", data)
end

.sr(data) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/scratchpaper.rb', line 26

def sr(data)
  case data
  when ActiveRecord::Relation
    st(data.map { |r| r.attributes.to_a })
  when ActiveRecord::Base
    st(r.attributes.to_a)
  end
end

.st(data) ⇒ Object



18
19
20
# File 'lib/scratchpaper.rb', line 18

def st(data)
  scratch_note("table", data)
end