class Mumukit::Bridge::Bibliotheca

Attributes

headers[RW]
url[RW]

Public Class Methods

new(url, timeout=10, headers={}) click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 6
def initialize(url, timeout=10, headers={})
  @url = url
  @timeout = timeout
  @headers = headers
end

Public Instance Methods

book(slug) click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 32
def book(slug)
  get_element 'books', slug
end
books() click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 20
def books
  get_collection 'books'
end
get(path) click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 44
def get(path)
  JSON.parse RestClient.get("#{url}/#{path}", self.headers)
end
get_collection(name) click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 36
def get_collection(name)
  get(name)[name]
end
get_element(name, slug) click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 40
def get_element(name, slug)
  get "#{name}/#{slug}"
end
guide(slug) click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 24
def guide(slug)
  get_element 'guides', slug
end
guides() click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 12
def guides
  get_collection 'guides'
end
topic(slug) click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 28
def topic(slug)
  get_element 'topics', slug
end
topics() click to toggle source
# File lib/mumukit/bridge/bibliotheca.rb, line 16
def topics
  get_collection 'topics'
end