class Elastic::EnterpriseSearch::AppSearch::Client
The App Search Client
Extends EnterpriseSearch
client but overrides authentication to use access token.
Constants
- SIGNED_KEY_ALGORITHM
Public Class Methods
create_signed_search_key(api_key, api_key_name, options = {})
click to toggle source
Build a JWT for authentication
@param [String] api_key the API Key to sign the request with @param [String] api_key_name the unique name for the API Key @option options see the App Search API for supported search options.
@return [String] the JWT to use for authentication
# File lib/elastic/app-search/app_search.rb, line 62 def create_signed_search_key(api_key, api_key_name, options = {}) payload = Elastic::EnterpriseSearch::Utils.symbolize_keys(options).merge(api_key_name: api_key_name) JWT.encode(payload, api_key, SIGNED_KEY_ALGORITHM) end
new(options = {})
click to toggle source
Create a new Elastic::EnterpriseSearch::AppSearch::Client
client
@param options [Hash] a hash of configuration options @option options [String] :host_identifier A unique string that represents your account. @option options [String] :api_key Part of the credentials
Calls superclass method
Elastic::EnterpriseSearch::Client::new
# File lib/elastic/app-search/app_search.rb, line 48 def initialize(options = {}) super(options) end
Public Instance Methods
date_to_rfc3339(date)
click to toggle source
# File lib/elastic/app-search/app_search.rb, line 76 def date_to_rfc3339(date) DateTime.parse(date.to_s).rfc3339 end
http_auth()
click to toggle source
# File lib/elastic/app-search/app_search.rb, line 68 def http_auth @options[:http_auth] end
http_auth=(api_key)
click to toggle source
# File lib/elastic/app-search/app_search.rb, line 72 def http_auth=(api_key) @options[:http_auth] = api_key end