Class: FatZebra::Batch

Inherits:
APIResource show all
Extended by:
APIOperation::Find, APIOperation::Search
Includes:
APIOperation::Delete, APIOperation::Save
Defined in:
lib/fat_zebra/batch.rb

Overview

FatZebra Batch

Manage Batch for the API

  • create

  • search

  • find

  • result

Constant Summary

Constants included from APIOperation::Search

APIOperation::Search::DEFAULT_PARAMS

Instance Attribute Summary

Attributes inherited from FatZebraObject

#data, #errors, #raw, #successful

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperation::Search

search

Methods included from APIOperation::Find

find

Methods included from APIOperation::Delete

#destroy, included

Methods included from APIOperation::Save

included, #save

Methods inherited from APIResource

class_name, #request, request, #resource_name, resource_name, resource_path, #resource_path

Methods inherited from FatZebraObject

#[], #[]=, #add_data, #initialize, initialize_from, #keys, #load_response_api, #to_hash, #to_json, #update_attributes, #update_from

Methods included from Validation

#errors, #valid!, #valid?, #validates

Constructor Details

This class inherits a constructor from FatZebra::FatZebraObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FatZebra::FatZebraObject

Class Method Details

.create(params, options = {}) ⇒ FatZebra::Batch

Upload a batch file



34
35
36
37
38
39
40
# File 'lib/fat_zebra/batch.rb', line 34

def create(params, options = {})
  params[:multipart] = true
  params[:content_type] = 'text/csv'
  params[:file] = File.new(params.delete(:path)) if params.key?(:path)

  super(params, options)
end

Instance Method Details

#result(params = {}, options = {}) ⇒ String

Return result from the batch



51
52
53
# File 'lib/fat_zebra/batch.rb', line 51

def result(params = {}, options = {})
  request(:get, "#{resource_path}/#{id}/result.csv", params, options)
end