module Signaling::Base::Persistence::ClassMethods

Public Instance Methods

create(params) click to toggle source
# File lib/signaling/base/persistence.rb, line 5
def create(params)
  from_response(request(:create, scope_params(params)))
rescue Signaling::Error::UnprocessableEntity => e
  from_response(e.response[:body])
end
destroy(id) click to toggle source
# File lib/signaling/base/persistence.rb, line 11
def destroy(id)
  from_response(request(:destroy, id: id))
end
param_key() click to toggle source
# File lib/signaling/base/persistence.rb, line 21
def param_key
  ActiveModel::Naming.param_key(self)
end
scope_params(params) click to toggle source
# File lib/signaling/base/persistence.rb, line 15
def scope_params(params)
  key = params.is_a?(Array) ? param_key.pluralize : param_key

  { key => to_params(params, true) }
end