class Castle::Commands::ListItems::Query
Builds the command to query list items
Public Class Methods
build(options = {})
click to toggle source
@param options [Hash] @return [Castle::Command]
# File lib/castle/commands/list_items/query.rb, line 11 def build(options = {}) Castle::Validators::Present.call(options, %i[list_id]) options[:filters]&.each { |f| Castle::Validators::Present.call(f, %i[field op value]) } Castle::Validators::Present.call(options[:sort], %i[field order]) if options[:sort] list_id = options.delete(:list_id) Castle::Command.new("lists/#{list_id}/items/query", options, :post) end