Class: Cliff

Inherits:
Object
  • Object
show all
Defined in:
lib/cliff.rb

Defined Under Namespace

Classes: Helpers, Snippet

Class Method Summary collapse

Class Method Details

.create(content, params) ⇒ Object



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

def create(content, params)
  snippet = Snippet.new(content, params)
  snippet.save
  Helpers.copy(snippet.url)
  return snippet
end

.fp_urlObject



32
33
34
# File 'lib/cliff.rb', line 32

def fp_url
  "http://www.friendpaste.com/"
end

.get(doc_id) ⇒ Object



26
27
28
29
30
# File 'lib/cliff.rb', line 26

def get(doc_id)
  headers = {"Accept" => "application/json"}
  raw = open("#{Cliff::fp_url}/#{doc_id}", headers).read
  Snippet.new(JSON.parse(raw))
end

.languagesObject



15
16
17
# File 'lib/cliff.rb', line 15

def languages
  @languages ||= Helpers.load_languages_from_cache
end