Class: Io::Flow::V0::Clients::ItemQuerySuggestions
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ItemQuerySuggestions
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(organization, incoming = {}) ⇒ Object
Returns search suggestions for catalog items.
-
#initialize(client) ⇒ ItemQuerySuggestions
constructor
A new instance of ItemQuerySuggestions.
Constructor Details
#initialize(client) ⇒ ItemQuerySuggestions
Returns a new instance of ItemQuerySuggestions.
6097 6098 6099 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6097 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(organization, incoming = {}) ⇒ Object
Returns search suggestions for catalog items
6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6102 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :q => (x = opts.delete(:q); x.nil? ? nil : HttpClient::Preconditions.assert_class('q', x, String)), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/search/item/query/suggestions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ItemQuerySuggestion.new(x) } end |