Skip to content

Commit

Permalink
Merge #508
Browse files Browse the repository at this point in the history
508: Add method for creating a snapshot r=ellnix a=andre-m-dev

# Pull Request

## Related issue
Fixes [504](#504)

## What does this PR do?
- Add a method to create a snapshot

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?


Co-authored-by: Andre <>
Co-authored-by: André <1729839+andre-m-dev@users.noreply.github.com>
  • Loading branch information
meili-bors[bot] and andre-m-dev committed Jan 17, 2024
2 parents 40f80cb + ec514a3 commit 5adacb7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .code-samples.meilisearch.yaml
Expand Up @@ -402,6 +402,8 @@ faceted_search_update_settings_1: |-
client.index('movie_ratings').update_filterable_attributes(['genres', 'rating', 'language'])
post_dump_1: |-
client.create_dump
create_snapshot_1: |-
client.create_snapshot
phrase_search_1: |-
client.index('movies').search('"african american" horror')
sorting_guide_update_sortable_attributes_1: |-
Expand Down
6 changes: 6 additions & 0 deletions lib/meilisearch/client.rb
Expand Up @@ -121,6 +121,12 @@ def create_dump
http_post '/dumps'
end

### SNAPSHOTS

def create_snapshot
http_post '/snapshots'
end

### TASKS

def cancel_tasks(options = {})
Expand Down
12 changes: 12 additions & 0 deletions spec/meilisearch/client/snapshots_spec.rb
@@ -0,0 +1,12 @@
# frozen_string_literal: true

RSpec.describe 'MeiliSearch::Client - Snapshots' do
it 'creates a new snapshot' do
response = client.create_snapshot
expect(response).to be_a(Hash)
expect(response['taskUid']).to_not be_nil
expect(response['status']).to_not be_nil
expect(response['status']).to eq('enqueued')
expect(response['type']).to eq('snapshotCreation')
end
end

0 comments on commit 5adacb7

Please sign in to comment.