Class: Io::Flow::V0::Clients::ExperiencePriceConversions
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ExperiencePriceConversions
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(organization, experience_key, incoming = {}) ⇒ Object
Converts one or more prices from one currency to another.
-
#initialize(client) ⇒ ExperiencePriceConversions
constructor
A new instance of ExperiencePriceConversions.
Constructor Details
#initialize(client) ⇒ ExperiencePriceConversions
Returns a new instance of ExperiencePriceConversions.
1750 1751 1752 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1750 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 prices from one currency to another
1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1755 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)), :amount => (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', x, Array).map { |v| HttpClient::Preconditions.assert_class('amount', v, String) }) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/conversions/price").with_query(query).get ::Io::Flow::V0::Models::ExperiencePriceConversionResponse.new(r) end |