Class: Io::Flow::V0::Clients::CatalogPriceBookItemDocuments
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::CatalogPriceBookItemDocuments
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(organization, incoming = {}) ⇒ Object
Returns price book item documents based on the search criteria.
-
#initialize(client) ⇒ CatalogPriceBookItemDocuments
constructor
A new instance of CatalogPriceBookItemDocuments.
Constructor Details
#initialize(client) ⇒ CatalogPriceBookItemDocuments
Returns a new instance of CatalogPriceBookItemDocuments.
5833 5834 5835 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5833 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(organization, incoming = {}) ⇒ Object
Returns price book item documents based on the search criteria
5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5838 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :price_book_key => (x = opts.delete(:price_book_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('price_book_key', x, Array).map { |v| HttpClient::Preconditions.assert_class('price_book_key', v, String) }), :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/price/books/items").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::CatalogPriceBookItemDocument.new(x) } end |