You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ruby.rb
    path of file: ./repos/puppet-elasticsearch/lib/puppet/provider/elasticsearch_snapshot_repository
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', '..'))

require 'puppet/provider/elastic_rest'

Puppet::Type.type(:elasticsearch_snapshot_repository).provide(
  :ruby,
  parent: Puppet::Provider::ElasticREST,
  api_u
    
  def generate_body
    Puppet.debug('Got to snapshot_repository.generate_body')
    # Build core request body
    body = {
      'type' => resource[:type],
      'settings' => {
        'compress' => resource[:compress],
        'location' => resource[:location]
      }
    }

    # Add optional values
    body['settings']['chunk_size'] = resource[:chunk_size] unless resource[:chunk_size].nil?
    body['settings']['max_restore_rate'] = resource[:max_restore_rate] unless resource[:max_restore_rate].nil?
    body['settings']['max_snapshot_rate'] = resource[:max_snapshot_rate] unless resource[:max_snapshot_rate].nil?

    # Convert to JSON and return
    JSON.generate(body)
  end