Module: C2PO

Defined in:
lib/c2po.rb,
lib/c2po/geom.rb,
lib/c2po/stat.rb,
lib/c2po/group.rb,
lib/c2po/scale.rb,
lib/c2po/records.rb,
lib/c2po/version.rb

Defined Under Namespace

Modules: Geom, Group, Scale, Stat Classes: C2POException, C2PORecord

Constant Summary collapse

C2PO_URL =
"http://c2po.keminglabs.com"
VERSION =
'0.0.2'
@@motd_printed =
false

Class Method Summary collapse

Class Method Details

.motd(url = C2PO_URL) ⇒ Object



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

def self.motd(url=C2PO_URL)
  res = Net::HTTP.get_response URI.parse url + "/motd"
  res.body
end


24
25
26
27
28
29
# File 'lib/c2po.rb', line 24

def self.print_once_motd!(url=C2PO_URL)
  unless @@motd_printed
    puts motd url
    @@motd_printed = true
  end
end

.render(spec, url = C2PO_URL) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/c2po.rb', line 31

def self.render(spec, url=C2PO_URL)
  print_once_motd!
  
  res = Net::HTTP.post_form(URI.parse(url),
                            "c2po" => spec.to_edn)
  if res.code != "200"
    raise C2POException.new, res.body
  else
    res.body
  end
end