Module: Hinoki::Stashes
- Defined in:
- lib/hinoki/stashes.rb
Class Method Summary collapse
-
.all(limit = nil, offset = nil) ⇒ Object
Lists all stashes.
-
.by_name(stash) ⇒ Object
Get information about a specific stash.
-
.create(path, content, expiration = nil) ⇒ Object
Add a new stash (JSON formatted).
-
.delete(stash) ⇒ Object
Remove a stash.
Class Method Details
.all(limit = nil, offset = nil) ⇒ Object
Lists all stashes
12 13 14 15 16 17 18 |
# File 'lib/hinoki/stashes.rb', line 12 def self.all(limit=nil, offset=nil) url = "/stashes" if limit then url.append("?limit=#{limit}") end if offset then url.append("&offset=#{offset}") end return @conn.get(url) end |
.by_name(stash) ⇒ Object
Get information about a specific stash
29 30 31 |
# File 'lib/hinoki/stashes.rb', line 29 def self.by_name(stash) return @conn.get("/stashes/#{stash}") end |
.create(path, content, expiration = nil) ⇒ Object
Add a new stash (JSON formatted)
21 22 23 24 25 26 |
# File 'lib/hinoki/stashes.rb', line 21 def self.create(path, content, expiration=nil) hash = {path: path, content: content} if expiration then hash.merge!({expire: expiration}) end return @conn.post('/stashes', JSON.generate(hash)) end |
.delete(stash) ⇒ Object
Remove a stash
34 35 36 |
# File 'lib/hinoki/stashes.rb', line 34 def self.delete(stash) return @conn.delete("/stashes/#{stash}") end |