Class: Castle::Commands::ListItems::Count

Inherits:
Object
  • Object
show all
Defined in:
lib/castle/commands/list_items/count.rb

Overview

Generates the payload for the POST /lists/:list_id/items/count request

Class Method Summary collapse

Class Method Details

.build(options = {}) ⇒ Castle::Command

Parameters:

  • options (Hash) (defaults to: {})

Returns:



11
12
13
14
15
16
17
18
# File 'lib/castle/commands/list_items/count.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]) }

  list_id = options.delete(:list_id)

  Castle::Command.new("lists/#{list_id}/items/count", options, :post)
end