Class: CodaDocs::Entities::Docs

Inherits:
Entity
  • Object
show all
Defined in:
lib/coda_docs/entities/docs.rb

Instance Method Summary collapse

Methods inherited from Entity

#connection, #initialize, #parse_response

Constructor Details

This class inherits a constructor from CodaDocs::Entities::Entity

Instance Method Details

#all(options = nil) ⇒ Object



4
5
6
7
# File 'lib/coda_docs/entities/docs.rb', line 4

def all(options = nil)
  response = connection.get('/docs', query: options)
  parse_response(response)
end

#create(options) ⇒ Object



13
14
15
16
17
18
# File 'lib/coda_docs/entities/docs.rb', line 13

def create(options)
  connection.post(
    '/docs',
    body: options.to_json
  )
end

#delete(doc_id) ⇒ Object



20
21
22
# File 'lib/coda_docs/entities/docs.rb', line 20

def delete(doc_id)
  connection.delete("/docs/#{doc_id}")
end

#find(doc_id) ⇒ Object



9
10
11
# File 'lib/coda_docs/entities/docs.rb', line 9

def find(doc_id)
  connection.get("/docs/#{doc_id}")
end

#publish(doc_id, options) ⇒ Object



24
25
26
27
28
29
# File 'lib/coda_docs/entities/docs.rb', line 24

def publish(doc_id, options)
  connection.put(
    "/docs/#{doc_id}/publish",
    body: options.to_json
  )
end

#unpublish(doc_id) ⇒ Object



31
32
33
# File 'lib/coda_docs/entities/docs.rb', line 31

def unpublish(doc_id)
  connection.delete("/docs/#{doc_id}/publish")
end