Class: Io::Flow::V0::Clients::Experiences

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Experiences

Returns a new instance of Experiences.



1191
1192
1193
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1191

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



1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1548

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



1417
1418
1419
1420
1421
1422
1423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1417

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



1514
1515
1516
1517
1518
1519
1520
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1514

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.



1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1196

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.



1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1523

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.



1574
1575
1576
1577
1578
1579
1580
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1574

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.



1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1233

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



1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1313

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.



1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1252

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



1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1584

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



1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1273

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.



1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1338

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



1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1351

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



1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1386

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



1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1364

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



1400
1401
1402
1403
1404
1405
1406
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1400

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



1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1438

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



1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1425

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



1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1467

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



1506
1507
1508
1509
1510
1511
1512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1506

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_and_versions_by_key(organization, key, incoming = {}) ⇒ Object

Get the pricing settings versions for this experience



1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1629

def get_pricing_and_versions_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 = {
    :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(key)}/pricing/versions").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::PricingVersion.new(x) }
end

#get_pricing_by_key(organization, key, incoming = {}) ⇒ Object

Get the pricing settings for this experience



1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1604

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



1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1644

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



1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1298

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



1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1220

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.



1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1561

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) ⇒ Object



1378
1379
1380
1381
1382
1383
1384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1378

def post_margins_by_experience_key(organization, experience_key, item_margin_post_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
  (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_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



1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1482

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



1290
1291
1292
1293
1294
1295
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1290

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.



1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1535

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



1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1324

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) ⇒ Object



1408
1409
1410
1411
1412
1413
1414
1415
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1408

def put_margins_by_experience_key_and_key(organization, experience_key, key, item_margin_put_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  (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_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.



1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1455

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



1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1494

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



1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1616

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.



1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1656

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