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.



1143
1144
1145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1143

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



1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1500

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



1369
1370
1371
1372
1373
1374
1375
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1369

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



1466
1467
1468
1469
1470
1471
1472
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1466

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.



1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1148

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.



1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1475

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.



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

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.



1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1185

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



1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1265

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.



1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1204

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



1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1536

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



1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1225

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.



1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1290

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



1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1303

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



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

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



1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1316

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



1352
1353
1354
1355
1356
1357
1358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1352

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



1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1390

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



1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1377

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



1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1419

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



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

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



1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1581

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



1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1556

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



1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1596

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



1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1250

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



1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1172

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.



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

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



1330
1331
1332
1333
1334
1335
1336
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1330

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



1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1434

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



1242
1243
1244
1245
1246
1247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1242

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.



1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1487

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



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

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



1360
1361
1362
1363
1364
1365
1366
1367
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1360

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.



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

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



1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1446

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



1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1568

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.



1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1608

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