Skip to content

Commit 5adacb7

Browse files
Merge #508
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é <[email protected]>
2 parents 40f80cb + ec514a3 commit 5adacb7

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

.code-samples.meilisearch.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ faceted_search_update_settings_1: |-
402402
client.index('movie_ratings').update_filterable_attributes(['genres', 'rating', 'language'])
403403
post_dump_1: |-
404404
client.create_dump
405+
create_snapshot_1: |-
406+
client.create_snapshot
405407
phrase_search_1: |-
406408
client.index('movies').search('"african american" horror')
407409
sorting_guide_update_sortable_attributes_1: |-

lib/meilisearch/client.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ def create_dump
121121
http_post '/dumps'
122122
end
123123

124+
### SNAPSHOTS
125+
126+
def create_snapshot
127+
http_post '/snapshots'
128+
end
129+
124130
### TASKS
125131

126132
def cancel_tasks(options = {})
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe 'MeiliSearch::Client - Snapshots' do
4+
it 'creates a new snapshot' do
5+
response = client.create_snapshot
6+
expect(response).to be_a(Hash)
7+
expect(response['taskUid']).to_not be_nil
8+
expect(response['status']).to_not be_nil
9+
expect(response['status']).to eq('enqueued')
10+
expect(response['type']).to eq('snapshotCreation')
11+
end
12+
end

0 commit comments

Comments
 (0)