Method: DataSift::Client#dpu

Defined in:
lib/datasift.rb

#dpu(hash = '', historics_id = '') ⇒ Object

Calculate the DPU cost of running a filter, or Historics query

Parameters:

  • hash (String) (defaults to: '')

    CSDL hash for which you wish to find the DPU cost

  • historics_id (String) (defaults to: '')

    ID of Historics query for which you wish to find the DPU cost

Returns:

  • (Object)

    API reponse object



127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/datasift.rb', line 127

def dpu(hash = '', historics_id = '')
  fail ArgumentError, 'Must pass a filter hash or Historics ID' if
    hash.empty? && historics_id.empty?
  fail ArgumentError, 'Must only pass hash or Historics ID; not both' unless
    hash.empty? || historics_id.empty?

  params = {}
  params.merge!(hash: hash) unless hash.empty?
  params.merge!(historics_id: historics_id) unless historics_id.empty?

  DataSift.request(:POST, 'dpu', @config, params)
end