class Algolia::Indices::Converter

Public Class Methods

load(path) click to toggle source
# File lib/algolia/indices/converter.rb, line 11
def self.load(path)
  self.new(YAML.load_file(path))
end
new(yaml) click to toggle source
# File lib/algolia/indices/converter.rb, line 7
def initialize(yaml)
  @yaml = yaml
end

Public Instance Methods

batch_write_operations_request_paramters() click to toggle source
# File lib/algolia/indices/converter.rb, line 15
def batch_write_operations_request_paramters
  assemble_batch_write_operations_request_paramters.to_json
end

Private Instance Methods

assemble_batch_write_operations_request_paramters() click to toggle source
# File lib/algolia/indices/converter.rb, line 21
def assemble_batch_write_operations_request_paramters
  records = @yaml['records'].map do |r|
    { 'action' => 'addObject',
      'body' => r}
  end
  { 'requests' => records }
end