class Plyushkin::Service::Stub
Public Class Methods
new()
click to toggle source
# File lib/plyushkin/service/stub.rb, line 3 def initialize @models = {} end
Public Instance Methods
get(model, id)
click to toggle source
# File lib/plyushkin/service/stub.rb, line 7 def get(model, id) JSON.parse(get_store(model)[id] || "{}") end
put(model, id, payload)
click to toggle source
# File lib/plyushkin/service/stub.rb, line 11 def put(model, id, payload) get_store(model)[id] = payload.to_json end
Private Instance Methods
get_store(model)
click to toggle source
# File lib/plyushkin/service/stub.rb, line 16 def get_store(model) if @models[model] store = @models[model] else store = @models[model] = {} end end