Class: FatZebra::Batch
- Inherits:
-
APIResource
- Object
- FatZebraObject
- APIResource
- FatZebra::Batch
- 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
-
.create(params, options = {}) ⇒ FatZebra::Batch
Upload a batch file.
Instance Method Summary collapse
-
#result(params = {}, options = {}) ⇒ String
Return result from the batch.
Methods included from APIOperation::Search
Methods included from APIOperation::Find
Methods included from APIOperation::Delete
Methods included from APIOperation::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, = {}) params[:multipart] = true params[:content_type] = 'text/csv' params[:file] = File.new(params.delete(:path)) if params.key?(:path) super(params, ) 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 = {}, = {}) request(:get, "#{resource_path}/#{id}/result.csv", params, ) end |