module Quiver::Patcher

Attributes

current_user[RW]
extra_params[RW]
operation[RW]

Public Class Methods

included(host) click to toggle source
# File lib/quiver/patcher.rb, line 3
def self.included(host)
  host.send(:include, AbstractAction)
  host.extend(ClassMethods)
end
new(operation, extra_params) click to toggle source
# File lib/quiver/patcher.rb, line 55
def initialize(operation, extra_params)
  self.extra_params = extra_params || {}
  self.operation = operation
end

Public Instance Methods

internal_call(_) click to toggle source
# File lib/quiver/patcher.rb, line 64
def internal_call(_)
  serialize_with(action)
end
params() click to toggle source
# File lib/quiver/patcher.rb, line 68
def params
  @params ||= begin
    if operation['value'].respond_to?(:to_h) && self.class.get_params_attributes_klass
      self.class.get_params_attributes_klass.new(extra_params.merge({data: operation['value'].to_h}))
    else
      extra_params.merge({data: operation['value']})
    end
  end
end
request_path() click to toggle source
# File lib/quiver/patcher.rb, line 82
def request_path
  @request_path ||= operation['path']
end
request_path_with_query() click to toggle source
# File lib/quiver/patcher.rb, line 86
def request_path_with_query
  request_path
end
run() click to toggle source
# File lib/quiver/patcher.rb, line 60
def run
  internal_call(nil)
end
serialize_with(data) click to toggle source
# File lib/quiver/patcher.rb, line 78
def serialize_with(data)
  self.class.serializer.new({collections: data}).serialize(context: self)
end