Class: Io::Flow::V0::Clients::ExperiencePriceFacetConversions
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ExperiencePriceFacetConversions
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(organization, experience_key, incoming = {}) ⇒ Object
Converts one or more price values into local currency, rounding for display in price facets.
-
#initialize(client) ⇒ ExperiencePriceFacetConversions
constructor
A new instance of ExperiencePriceFacetConversions.
Constructor Details
#initialize(client) ⇒ ExperiencePriceFacetConversions
Returns a new instance of ExperiencePriceFacetConversions.
1772 1773 1774 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1772 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(organization, experience_key, incoming = {}) ⇒ Object
Converts one or more price values into local currency, rounding for display in price facets. A common use case is to say show a price filter to consumers (e.g. 10-20 USD) and want to display that in local currency (15-30 CAD). To do so, send the values ‘10’ and ‘20’ to this API which will return the rounded local currency facet values
1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1781 def get(organization, experience_key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :base => (x = opts.delete(:base); x.nil? ? nil : HttpClient::Preconditions.assert_class('base', x, String)), :local => (x = opts.delete(:local); x.nil? ? nil : HttpClient::Preconditions.assert_class('local', x, String)), :min => (x = opts.delete(:min); x.nil? ? nil : HttpClient::Preconditions.assert_class('min', x, Array).map { |v| HttpClient::Preconditions.assert_class('min', v, String) }), :max => (x = opts.delete(:max); x.nil? ? nil : HttpClient::Preconditions.assert_class('max', x, Array).map { |v| HttpClient::Preconditions.assert_class('max', v, String) }) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/conversions/price/facet").with_query(query).get ::Io::Flow::V0::Models::ExperiencePriceFacetConversionResponse.new(r) end |