class SKVS::HttpAdapter
Public Instance Methods
del(key)
click to toggle source
# File lib/platform/skvs/http_adapter.rb, line 25 def del(key) HTTP.delete(url(key)).tap do |response| return (200..299).include?(response.status) end end
get(key)
click to toggle source
# File lib/platform/skvs/http_adapter.rb, line 9 def get(key) HTTP.get(url(key)).tap do |response| if (200..299).include? response.status return JSON.load(response.body)['value'] else return nil end end end
set(key, value)
click to toggle source
# File lib/platform/skvs/http_adapter.rb, line 19 def set(key, value) HTTP.put(url(key), form: { value: value }).tap do |response| return (200..299).include?(response.status) end end
url(path)
click to toggle source
# File lib/platform/skvs/http_adapter.rb, line 5 def url(path) File.join 'http://skvs', path end