Class: Io::Flow::V0::Clients::Documents
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Documents
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get_catalog(organization, incoming = {}) ⇒ Object
Returns items based on search criteria.
-
#get_harmonization(organization, incoming = {}) ⇒ Object
Returns harmonization information based on search criteria.
-
#initialize(client) ⇒ Documents
constructor
A new instance of Documents.
Constructor Details
#initialize(client) ⇒ Documents
Returns a new instance of Documents.
6602 6603 6604 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6602 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get_catalog(organization, incoming = {}) ⇒ Object
Returns items based on search criteria
6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6607 def get_catalog(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), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "name" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/search/catalog").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::CatalogItemDocument.new(x) } end |
#get_harmonization(organization, incoming = {}) ⇒ Object
Returns harmonization information based on search criteria
6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6621 def get_harmonization(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), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/search/harmonization").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::HarmonizationDocument.new(x) } end |