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.



1038
1039
1040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1038

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#delete_by_key(organization, key) ⇒ Object

Delete the experience with this key



1355
1356
1357
1358
1359
1360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1355

def delete_by_key(organization, key)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}").delete
  nil
end

#delete_margins_by_experience_key_and_key(organization, experience_key, key) ⇒ Object



1246
1247
1248
1249
1250
1251
1252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1246

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



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

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.



1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1043

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

Returns information about a specific experience.



1338
1339
1340
1341
1342
1343
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1338

def get_by_key(organization, key)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}").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.



1373
1374
1375
1376
1377
1378
1379
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1373

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.



1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1075

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



1151
1152
1153
1154
1155
1156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1151

def get_currency_and_formats_by_experience_key(organization, experience_key)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/currency/formats").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.



1093
1094
1095
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 1093

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)),
    :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



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

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))
  }.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



1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1113

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))
  }.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.



1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1168

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))
  }.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



1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1180

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



1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1215

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



1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1193

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



1229
1230
1231
1232
1233
1234
1235
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1229

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



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

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))
  }.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



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

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)
  }.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



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

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



1321
1322
1323
1324
1325
1326
1327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1321

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

Get the pricing settings for this experience



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

def get_pricing_by_key(organization, key)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/pricing").get
  ::Io::Flow::V0::Models::Pricing.new(r)
end

#get_promotions_and_available_by_key(organization, key) ⇒ Object

Get available promotions for the experience



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

def get_promotions_and_available_by_key(organization, key)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/promotions/available").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



1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1137

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) }),
    :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) ⇒ Object

Add experience



1066
1067
1068
1069
1070
1071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1066

def post(organization, experience_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (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_json(experience_form.to_json).post
  ::Io::Flow::V0::Models::Experience.new(r)
end

#post_clone_by_key(organization, key, experience_clone_form) ⇒ Object

Clones the experience with the specified key, using data from experience_clone_form.



1364
1365
1366
1367
1368
1369
1370
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1364

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



1207
1208
1209
1210
1211
1212
1213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1207

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



1305
1306
1307
1308
1309
1310
1311
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1305

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



1129
1130
1131
1132
1133
1134
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1129

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

Update experience with the specified key, creating if it does not exist.



1346
1347
1348
1349
1350
1351
1352
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1346

def put_by_key(organization, key, experience_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  (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_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) ⇒ Object



1158
1159
1160
1161
1162
1163
1164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1158

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



1237
1238
1239
1240
1241
1242
1243
1244
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1237

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

Change the ordering or payment tags for an experience. Every post must include one entry for each payment method offered by Flow.



1282
1283
1284
1285
1286
1287
1288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1282

def put_payment_and_method_and_rules_by_experience_key(organization, experience_key, experience_payment_method_rule_forms)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
  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_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) ⇒ Object



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

def put_price_and_books_by_experience_key(organization, experience_key, experience_price_book_mapping_put_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
  (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_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) ⇒ Object

Update the pricing settings for this experience



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

def put_pricing_by_key(organization, key, pricing)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  (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_json(pricing.to_json).put
  ::Io::Flow::V0::Models::Pricing.new(r)
end

#put_status_by_key(organization, key, experience_status_form) ⇒ Object

Updates the status of a given experience.



1427
1428
1429
1430
1431
1432
1433
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1427

def put_status_by_key(organization, key, experience_status_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  (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_json(experience_status_form.to_json).put
  ::Io::Flow::V0::Models::Experience.new(r)
end