Class: Io::Flow::V0::Clients::Experiences
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Experiences
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#delete_by_key(organization, key, incoming = {}) ⇒ Object
Delete the experience with this key.
- #delete_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
- #delete_price_and_books_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
-
#get(organization, incoming = {}) ⇒ Object
Search experiences.
-
#get_by_key(organization, key, incoming = {}) ⇒ Object
Returns information about a specific experience.
-
#get_clone_by_key_and_id(organization, key, id) ⇒ Object
Returns the experience_clone associated with the id.
-
#get_conversions_by_base_and_amount(organization, base, amount, incoming = {}) ⇒ Object
Formats the requested amount using the formatting settings for the experience.
- #get_currency_and_formats_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
-
#get_items(organization, incoming = {}) ⇒ Object
Returns localized information about 1 or more items.
-
#get_items_and_price_by_key_and_number(organization, key, number, incoming = {}) ⇒ Object
Returns detailed information on the pricing of this item within this experience.
-
#get_items_by_number(organization, number, incoming = {}) ⇒ Object
Returns information about this item localized based on the query parameters.
-
#get_local_and_items_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
Returns localized information about 0 or more items given a query for the specified experience.
- #get_logistics_and_summary_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_margins_and_versions_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_margins_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
- #get_payment_and_method_and_rules_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_payment_method_types_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_price_and_books_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
- #get_price_and_books_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
-
#get_pricing_by_key(organization, key, incoming = {}) ⇒ Object
Get the pricing settings for this experience.
-
#get_promotions_and_available_by_key(organization, key, incoming = {}) ⇒ Object
Get available promotions for the experience.
-
#get_versions(organization, incoming = {}) ⇒ Object
Provides visibility into recent changes of each object, including deletion.
-
#initialize(client) ⇒ Experiences
constructor
A new instance of Experiences.
-
#post(organization, experience_form, incoming = {}) ⇒ Object
Add experience.
-
#post_clone_by_key(organization, key, experience_clone_form, incoming = {}) ⇒ Object
Clones the experience with the specified key, using data from experience_clone_form.
- #post_margins_by_experience_key(organization, experience_key, item_margin_post_form, incoming = {}) ⇒ Object
- #post_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_form, incoming = {}) ⇒ Object
-
#post_query_and_builders(organization, query_builder_form) ⇒ Object
Builds a query to search experiences.
-
#put_by_key(organization, key, experience_form, incoming = {}) ⇒ Object
Update experience with the specified key, creating if it does not exist.
- #put_currency_and_formats_by_experience_key(organization, experience_key, experience_currency_format_form, incoming = {}) ⇒ Object
- #put_margins_by_experience_key_and_key(organization, experience_key, key, item_margin_put_form, incoming = {}) ⇒ Object
-
#put_payment_and_method_and_rules_by_experience_key(organization, experience_key, experience_payment_method_rule_forms, incoming = {}) ⇒ Object
Change the ordering or payment tags for an experience.
- #put_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_put_form, incoming = {}) ⇒ Object
-
#put_pricing_by_key(organization, key, pricing, incoming = {}) ⇒ Object
Update the pricing settings for this experience.
-
#put_status_by_key(organization, key, experience_status_form, incoming = {}) ⇒ Object
Updates the status of a given experience.
Constructor Details
#initialize(client) ⇒ Experiences
Returns a new instance of Experiences.
1054 1055 1056 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1054 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_key(organization, key, incoming = {}) ⇒ Object
Delete the experience with this key
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1419 def delete_by_key(organization, key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}").with_query(query).delete nil end |
#delete_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
1288 1289 1290 1291 1292 1293 1294 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1288 def delete_margins_by_experience_key_and_key(organization, experience_key, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins/#{CGI.escape(key)}").delete nil end |
#delete_price_and_books_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
1385 1386 1387 1388 1389 1390 1391 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1385 def delete_price_and_books_by_experience_key_and_key(organization, experience_key, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books/#{CGI.escape(key)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
Search experiences. Always paginated.
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1059 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)), :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }), :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, String)), :region => (x = opts.delete(:region); x.nil? ? nil : HttpClient::Preconditions.assert_class('region', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :subcatalog => (x = opts.delete(:subcatalog); x.nil? ? nil : HttpClient::Preconditions.assert_class('subcatalog', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :status => (x = opts.delete(:status); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExperienceStatus) ? x : ::Io::Flow::V0::Models::ExperienceStatus.apply(x)).value), :shipping_configuration_key => (x = opts.delete(:shipping_configuration_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('shipping_configuration_key', x, String)), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', 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? ? "position" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Experience.new(x) } end |
#get_by_key(organization, key, incoming = {}) ⇒ Object
Returns information about a specific experience.
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1394 def get_by_key(organization, key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}").with_query(query).get ::Io::Flow::V0::Models::Experience.new(r) end |
#get_clone_by_key_and_id(organization, key, id) ⇒ Object
Returns the experience_clone associated with the id.
1445 1446 1447 1448 1449 1450 1451 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1445 def get_clone_by_key_and_id(organization, key, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/clone/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::ExperienceClone.new(r) end |
#get_conversions_by_base_and_amount(organization, base, amount, incoming = {}) ⇒ Object
Formats the requested amount using the formatting settings for the experience.
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1096 def get_conversions_by_base_and_amount(organization, base, amount, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('base', base, String) HttpClient::Preconditions.assert_class('amount', amount, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/conversions/#{CGI.escape(base)}/#{CGI.escape(amount)}").with_query(query).get ::Io::Flow::V0::Models::PriceWithBase.new(r) end |
#get_currency_and_formats_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1176 def get_currency_and_formats_by_experience_key(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 = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/currency/formats").with_query(query).get ::Io::Flow::V0::Models::ExperienceCurrencyFormat.new(r) end |
#get_items(organization, incoming = {}) ⇒ Object
Returns localized information about 1 or more items. The items will be localized based on the experience selected by the query parameters in the order of experience, then country, then ip address.
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1115 def get_items(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :number => (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, Array).map { |v| HttpClient::Preconditions.assert_class('number', v, String) }), :status => (x = opts.delete(:status); x.nil? ? nil : HttpClient::Preconditions.assert_class('status', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x)).value }), :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', 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)}/experiences/items").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Item.new(x) } end |
#get_items_and_price_by_key_and_number(organization, key, number, incoming = {}) ⇒ Object
Returns detailed information on the pricing of this item within this experience
1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1455 def get_items_and_price_by_key_and_number(organization, key, number, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :price_amount => (x = opts.delete(:price_amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('price_amount', x, Numeric)), :price_currency => (x = opts.delete(:price_currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('price_currency', x, String)), :ship_from_country => (x = opts.delete(:ship_from_country); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_from_country', x, String)), :ship_from_province => (x = opts.delete(:ship_from_province); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_from_province', x, String)), :ship_to_country => (x = opts.delete(:ship_to_country); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_to_country', x, String)), :ship_to_province => (x = opts.delete(:ship_to_province); x.nil? ? nil : HttpClient::Preconditions.assert_class('ship_to_province', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/items/#{CGI.escape(number)}/price").with_query(query).get ::Io::Flow::V0::Models::PriceCheck.new(r) end |
#get_items_by_number(organization, number, incoming = {}) ⇒ Object
Returns information about this item localized based on the query parameters
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1136 def get_items_by_number(organization, number, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('number', number, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/items/#{CGI.escape(number)}").with_query(query).get ::Io::Flow::V0::Models::Item.new(r) end |
#get_local_and_items_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
Returns localized information about 0 or more items given a query for the specified experience.
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1201 def get_local_and_items_by_experience_key(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 = { :q => (x = opts.delete(:q); x.nil? ? nil : HttpClient::Preconditions.assert_class('q', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/local/items").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::LocalItem.new(x) } end |
#get_logistics_and_summary_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1214 def get_logistics_and_summary_by_experience_key(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 = { :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :number => (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/logistics/summary").with_query(query).get ::Io::Flow::V0::Models::ExperienceLogisticsSummary.new(r) end |
#get_margins_and_versions_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1253 def get_margins_and_versions_by_experience_key(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 = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, 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? ? "journal_timestamp" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins/versions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ItemMarginVersion.new(x) } end |
#get_margins_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1227 def get_margins_by_experience_key(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 = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, 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)}/experiences/#{CGI.escape(experience_key)}/margins").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ItemMargin.new(x) } end |
#get_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
1267 1268 1269 1270 1271 1272 1273 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1267 def get_margins_by_experience_key_and_key(organization, experience_key, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::ItemMargin.new(r) end |
#get_payment_and_method_and_rules_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1309 def get_payment_and_method_and_rules_by_experience_key(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 = { :payment_method_type => (x = opts.delete(:payment_method_type); x.nil? ? nil : HttpClient::Preconditions.assert_class('payment_method_type', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentMethodType) ? x : ::Io::Flow::V0::Models::PaymentMethodType.apply(x)).value }), :tags => (x = opts.delete(:tags); x.nil? ? nil : HttpClient::Preconditions.assert_class('tags', x, Array).map { |v| HttpClient::Preconditions.assert_class('tags', v, String) }), :amount => (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/payment/method/rules").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::PaymentMethodRule.new(x) } end |
#get_payment_method_types_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1296 def get_payment_method_types_by_experience_key(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 = { :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), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/payment-method-types").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::PaymentMethodType.new(x) } end |
#get_price_and_books_by_experience_key(organization, experience_key, incoming = {}) ⇒ Object
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1338 def get_price_and_books_by_experience_key(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 = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :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) }), :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? ? "position" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ExperiencePriceBookMapping.new(x) } end |
#get_price_and_books_by_experience_key_and_key(organization, experience_key, key) ⇒ Object
1377 1378 1379 1380 1381 1382 1383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1377 def get_price_and_books_by_experience_key_and_key(organization, experience_key, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::ExperiencePriceBookMapping.new(r) end |
#get_pricing_by_key(organization, key, incoming = {}) ⇒ Object
Get the pricing settings for this experience
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1475 def get_pricing_by_key(organization, key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/pricing").with_query(query).get ::Io::Flow::V0::Models::Pricing.new(r) end |
#get_promotions_and_available_by_key(organization, key, incoming = {}) ⇒ Object
Get available promotions for the experience
1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1500 def get_promotions_and_available_by_key(organization, key, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/promotions/available").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Promotion.from_json(x) } end |
#get_versions(organization, incoming = {}) ⇒ Object
Provides visibility into recent changes of each object, including deletion
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1161 def get_versions(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, Array).map { |v| HttpClient::Preconditions.assert_class('key', v, String) }), :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', 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? ? "journal_timestamp" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/experiences/versions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ExperienceVersion.new(x) } end |
#post(organization, experience_form, incoming = {}) ⇒ Object
Add experience
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1083 def post(organization, experience_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = experience_form; x.is_a?(::Io::Flow::V0::Models::ExperienceForm) ? x : ::Io::Flow::V0::Models::ExperienceForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences").with_query(query).with_json(experience_form.to_json).post ::Io::Flow::V0::Models::Experience.new(r) end |
#post_clone_by_key(organization, key, experience_clone_form, incoming = {}) ⇒ Object
Clones the experience with the specified key, using data from experience_clone_form.
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1432 def post_clone_by_key(organization, key, experience_clone_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = experience_clone_form; x.is_a?(::Io::Flow::V0::Models::ExperienceCloneForm) ? x : ::Io::Flow::V0::Models::ExperienceCloneForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/clone").with_query(query).with_json(experience_clone_form.to_json).post ::Io::Flow::V0::Models::ExperienceClone.new(r) end |
#post_margins_by_experience_key(organization, experience_key, item_margin_post_form, incoming = {}) ⇒ Object
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1241 def post_margins_by_experience_key(organization, experience_key, item_margin_post_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = item_margin_post_form; x.is_a?(::Io::Flow::V0::Models::ItemMarginPostForm) ? x : ::Io::Flow::V0::Models::ItemMarginPostForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins").with_query(query).with_json(item_margin_post_form.to_json).post ::Io::Flow::V0::Models::ItemMargin.new(r) end |
#post_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_form, incoming = {}) ⇒ Object
1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1353 def post_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = experience_price_book_mapping_form; x.is_a?(::Io::Flow::V0::Models::ExperiencePriceBookMappingForm) ? x : ::Io::Flow::V0::Models::ExperiencePriceBookMappingForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books").with_query(query).with_json(experience_price_book_mapping_form.to_json).post ::Io::Flow::V0::Models::ExperiencePriceBookMapping.new(r) end |
#post_query_and_builders(organization, query_builder_form) ⇒ Object
Builds a query to search experiences
1153 1154 1155 1156 1157 1158 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1153 def post_query_and_builders(organization, query_builder_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = query_builder_form; x.is_a?(::Io::Flow::V0::Models::QueryBuilderForm) ? x : ::Io::Flow::V0::Models::QueryBuilderForm.from_json(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/query/builders").with_json(query_builder_form.to_json).post ::Io::Flow::V0::Models::QueryBuilder.new(r) end |
#put_by_key(organization, key, experience_form, incoming = {}) ⇒ Object
Update experience with the specified key, creating if it does not exist.
1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1406 def put_by_key(organization, key, experience_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = experience_form; x.is_a?(::Io::Flow::V0::Models::ExperienceForm) ? x : ::Io::Flow::V0::Models::ExperienceForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}").with_query(query).with_json(experience_form.to_json).put ::Io::Flow::V0::Models::Experience.new(r) end |
#put_currency_and_formats_by_experience_key(organization, experience_key, experience_currency_format_form, incoming = {}) ⇒ Object
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1187 def put_currency_and_formats_by_experience_key(organization, experience_key, experience_currency_format_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = experience_currency_format_form; x.is_a?(::Io::Flow::V0::Models::ExperienceCurrencyFormatForm) ? x : ::Io::Flow::V0::Models::ExperienceCurrencyFormatForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/currency/formats").with_query(query).with_json(experience_currency_format_form.to_json).put ::Io::Flow::V0::Models::ExperienceCurrencyFormat.new(r) end |
#put_margins_by_experience_key_and_key(organization, experience_key, key, item_margin_put_form, incoming = {}) ⇒ Object
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1275 def put_margins_by_experience_key_and_key(organization, experience_key, key, item_margin_put_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = item_margin_put_form; x.is_a?(::Io::Flow::V0::Models::ItemMarginPutForm) ? x : ::Io::Flow::V0::Models::ItemMarginPutForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins/#{CGI.escape(key)}").with_query(query).with_json(item_margin_put_form.to_json).put ::Io::Flow::V0::Models::ItemMargin.new(r) end |
#put_payment_and_method_and_rules_by_experience_key(organization, experience_key, experience_payment_method_rule_forms, incoming = {}) ⇒ Object
Change the ordering or payment tags for an experience. Every post must include one entry for each payment method offered by Flow.
1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1326 def put_payment_and_method_and_rules_by_experience_key(organization, experience_key, experience_payment_method_rule_forms, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } HttpClient::Preconditions.assert_class('experience_payment_method_rule_forms', experience_payment_method_rule_forms, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ExperiencePaymentMethodRuleForm) ? x : ::Io::Flow::V0::Models::ExperiencePaymentMethodRuleForm.new(x)) } r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/payment/method/rules").with_query(query).with_json(experience_payment_method_rule_forms.map { |o| o.to_hash }.to_json).put r.map { |x| ::Io::Flow::V0::Models::PaymentMethodRule.new(x) } end |
#put_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_put_form, incoming = {}) ⇒ Object
1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1365 def put_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_put_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('experience_key', experience_key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = experience_price_book_mapping_put_form; x.is_a?(::Io::Flow::V0::Models::ExperiencePriceBookMappingPutForm) ? x : ::Io::Flow::V0::Models::ExperiencePriceBookMappingPutForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/price/books").with_query(query).with_json(experience_price_book_mapping_put_form.to_json).put r.map { |x| ::Io::Flow::V0::Models::ExperiencePriceBookMapping.new(x) } end |
#put_pricing_by_key(organization, key, pricing, incoming = {}) ⇒ Object
Update the pricing settings for this experience
1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1487 def put_pricing_by_key(organization, key, pricing, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = pricing; x.is_a?(::Io::Flow::V0::Models::Pricing) ? x : ::Io::Flow::V0::Models::Pricing.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/pricing").with_query(query).with_json(pricing.to_json).put ::Io::Flow::V0::Models::Pricing.new(r) end |
#put_status_by_key(organization, key, experience_status_form, incoming = {}) ⇒ Object
Updates the status of a given experience.
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1512 def put_status_by_key(organization, key, experience_status_form, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String)) }.delete_if { |k, v| v.nil? } (x = experience_status_form; x.is_a?(::Io::Flow::V0::Models::ExperienceStatusForm) ? x : ::Io::Flow::V0::Models::ExperienceStatusForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/status").with_query(query).with_json(experience_status_form.to_json).put ::Io::Flow::V0::Models::Experience.new(r) end |