Skip to content

Commit

Permalink
Merge pull request #2 from blueshift-labs/account-sanitizer
Browse files Browse the repository at this point in the history
Add code to update sanitizer for an account
  • Loading branch information
vishwajitparasar-bsft authored Sep 15, 2022
2 parents f3e8f2d + ce3e9f9 commit 5e2cd6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/apollo/clients/accounts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def run_sanitizer(type:, document:, sanitizer: nil)
sanitizer: sanitizer
}.delete_if { |_, v| v.nil? })
end

def update_sanitizer(sanitizer:, override:false)
handle_request("sanitizers/account/#{@account}", :put, params: {override: override}, body: sanitizer)
end
end
end
end
4 changes: 4 additions & 0 deletions lib/apollo/models/sanitizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ def update
end
end

def update_account
Apollo.indices.for_account(@account).update_sanitizer(sanitizer: self, override: false)
end

def override
if !@index.nil?
Apollo.indices.for_index(@index).update_sanitizer(sanitizer: self, override: true)
Expand Down

0 comments on commit 5e2cd6f

Please sign in to comment.