module Dotloop::QueryParamHelpers

Constants

BATCH_SIZE
MAX_CONTACTS
MAX_LOOPS

Private Instance Methods

batch_number(options) click to toggle source
# File lib/dotloop/query_param_helpers.rb, line 27
def batch_number(options)
  options[:batch_number].to_i
end
batch_size(options) click to toggle source
# File lib/dotloop/query_param_helpers.rb, line 31
def batch_size(options)
  size = options[:batch_size].to_i
  size.between?(1, BATCH_SIZE) ? size : BATCH_SIZE
end
profile_id(options) click to toggle source
# File lib/dotloop/query_param_helpers.rb, line 22
def profile_id(options)
  raise 'profile_id is required' unless options[:profile_id]
  options[:profile_id].to_i
end
query_params(options) click to toggle source
# File lib/dotloop/query_param_helpers.rb, line 11
def query_params(options)
  {
    batch_number: batch_number(options),
    batch_size: batch_size(options)
  }.delete_if { |_, v| should_delete(v) }
end
should_delete(value) click to toggle source
# File lib/dotloop/query_param_helpers.rb, line 18
def should_delete(value)
  value.nil? || (value.is_a?(Integer) && value.zero?) || (value.is_a?(String) && value.size.zero?)
end