flowcommerce 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7926709f3cc6036d7bb49c094300f2cd5fdfc18f
4
- data.tar.gz: df79fe5daf67689d90466051f73c65d8034eb57e
3
+ metadata.gz: 72a5107c84e60eb68dd95478e53bc389f652ee8a
4
+ data.tar.gz: c70fa4bde6b7e370fe4f2438f24cfe1f64514e20
5
5
  SHA512:
6
- metadata.gz: 2cbb1f577040666e3cdf91dfdf718b52adfc8e75c0bd27353722316f3e3e153b8f0bff1ba2cb40abd93a9aa28a76a8e68bca1c6b8eaeb707ef33d7f5f2e9825a
7
- data.tar.gz: 7e4d5d99550c9e4db1a329ed3e2612909ed3d73cfc85345287f7be987c30eeb043085fa3634dcd2984a7306c7d4058518fa902fb6d52446c6967b45d67a6ea0e
6
+ metadata.gz: 93064d8cb7d0cdc0218a63efe6fb9e570c4e28bf07d127bc7e56cf29e168efa839d08251ae3ff430a24ef3a6a07399fa11dfbe322ede4749ed73881a3fc66004
7
+ data.tar.gz: a699e831f89e1444ba38d2c82bd3a3f4d3130bf7bb6fdf26a6daaac66dcc4775917c2b3b16f779ee205f0f67dd5465632c06e0fc4d7f00b00c61d084410e263b
@@ -0,0 +1,48 @@
1
+ module FlowCommerce
2
+
3
+ DEFAULT_TOKEN_FILE_LOCATION = "~/.flow/token"
4
+
5
+ # Creates a new instance of the flow cient, using standard
6
+ # conventions to identify the API TOKEN, checking in order:
7
+ #
8
+ # 1. an environment variable named FLOW_TOKEN
9
+ # 2. an environment variable named FLOW_TOKEN_FILE containing
10
+ # the path of the file with the token in it
11
+ #
12
+ # @param base_url Alternate URL for the API
13
+ def FlowCommerce.instance(opts={})
14
+ base_url = opts[:base_url].to_s.strip
15
+ token = opts[:token].to_s.strip
16
+ http_handler = opts[:http_handler]
17
+
18
+ if token.empty?
19
+ token = ENV['FLOW_TOKEN'].to_s.strip
20
+
21
+ if token.empty?
22
+ file = ENV['FLOW_TOKEN_FILE'].to_s.strip
23
+ if file.empty?
24
+ file = DEFAULT_TOKEN_FILE_LOCATION
25
+ end
26
+ path = File.expand_path(file)
27
+
28
+ if !File.exists?(path)
29
+ raise "File %s does not exist. You can specify environment variable FLOW_TOKEN or FLOW_TOKEN_FILE to explicitly provide the token" % path
30
+ end
31
+
32
+ token = IO.read(path).strip
33
+ if token.empty?
34
+ raise "File %s did not contain an API Token" % path
35
+ end
36
+ end
37
+ end
38
+
39
+ auth = Io::Flow::V0::HttpClient::Authorization.basic(token)
40
+
41
+ if base_url.empty?
42
+ Io::Flow::V0::Client.at_base_url(:authorization => auth, :http_handler => http_handler)
43
+ else
44
+ Io::Flow::V0::Client.new(base_url, :authorization => auth, :http_handler => http_handler)
45
+ end
46
+ end
47
+
48
+ end
@@ -428,7 +428,7 @@ module Io
428
428
  # Add attribute
429
429
  def post(organization, attribute_form)
430
430
  HttpClient::Preconditions.assert_class('organization', organization, String)
431
- HttpClient::Preconditions.assert_class('attribute_form', attribute_form, ::Io::Flow::V0::Models::AttributeForm)
431
+ (x = attribute_form; x.is_a?(::Io::Flow::V0::Models::AttributeForm) ? x : ::Io::Flow::V0::Models::AttributeForm.new(x))
432
432
  r = @client.request("/#{CGI.escape(organization)}/attributes").with_json(attribute_form.to_json).post
433
433
  ::Io::Flow::V0::Models::Attribute.new(r)
434
434
  end
@@ -445,7 +445,7 @@ module Io
445
445
  def put_by_key(organization, key, attribute_form)
446
446
  HttpClient::Preconditions.assert_class('organization', organization, String)
447
447
  HttpClient::Preconditions.assert_class('key', key, String)
448
- HttpClient::Preconditions.assert_class('attribute_form', attribute_form, ::Io::Flow::V0::Models::AttributeForm)
448
+ (x = attribute_form; x.is_a?(::Io::Flow::V0::Models::AttributeForm) ? x : ::Io::Flow::V0::Models::AttributeForm.new(x))
449
449
  r = @client.request("/#{CGI.escape(organization)}/attributes/#{CGI.escape(key)}").with_json(attribute_form.to_json).put
450
450
  ::Io::Flow::V0::Models::Attribute.new(r)
451
451
  end
@@ -566,7 +566,7 @@ module Io
566
566
  # Add experience
567
567
  def post(organization, experience_form)
568
568
  HttpClient::Preconditions.assert_class('organization', organization, String)
569
- HttpClient::Preconditions.assert_class('experience_form', experience_form, ::Io::Flow::V0::Models::ExperienceForm)
569
+ (x = experience_form; x.is_a?(::Io::Flow::V0::Models::ExperienceForm) ? x : ::Io::Flow::V0::Models::ExperienceForm.new(x))
570
570
  r = @client.request("/#{CGI.escape(organization)}/experiences").with_json(experience_form.to_json).post
571
571
  ::Io::Flow::V0::Models::Experience.new(r)
572
572
  end
@@ -588,7 +588,7 @@ module Io
588
588
  def post_margins_by_experience_key(organization, experience_key, item_margin_post_form)
589
589
  HttpClient::Preconditions.assert_class('organization', organization, String)
590
590
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
591
- HttpClient::Preconditions.assert_class('item_margin_post_form', item_margin_post_form, ::Io::Flow::V0::Models::ItemMarginPostForm)
591
+ (x = item_margin_post_form; x.is_a?(::Io::Flow::V0::Models::ItemMarginPostForm) ? x : ::Io::Flow::V0::Models::ItemMarginPostForm.new(x))
592
592
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins").with_json(item_margin_post_form.to_json).post
593
593
  ::Io::Flow::V0::Models::ItemMargin.new(r)
594
594
  end
@@ -605,7 +605,7 @@ module Io
605
605
  HttpClient::Preconditions.assert_class('organization', organization, String)
606
606
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
607
607
  HttpClient::Preconditions.assert_class('key', key, String)
608
- HttpClient::Preconditions.assert_class('item_margin_put_form', item_margin_put_form, ::Io::Flow::V0::Models::ItemMarginPutForm)
608
+ (x = item_margin_put_form; x.is_a?(::Io::Flow::V0::Models::ItemMarginPutForm) ? x : ::Io::Flow::V0::Models::ItemMarginPutForm.new(x))
609
609
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/margins/#{CGI.escape(key)}").with_json(item_margin_put_form.to_json).put
610
610
  ::Io::Flow::V0::Models::ItemMargin.new(r)
611
611
  end
@@ -652,7 +652,7 @@ module Io
652
652
  def put_payment_method_rules_by_experience_key(organization, experience_key, experience_payment_method_rule_forms)
653
653
  HttpClient::Preconditions.assert_class('organization', organization, String)
654
654
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
655
- HttpClient::Preconditions.assert_collection_of_class('experience_payment_method_rule_forms', experience_payment_method_rule_forms, ::Io::Flow::V0::Models::ExperiencePaymentMethodRuleForm)
655
+ 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)) }
656
656
  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
657
657
  r.map { |x| ::Io::Flow::V0::Models::PaymentMethodRule.new(x) }
658
658
  end
@@ -681,7 +681,7 @@ module Io
681
681
  def put_by_key(organization, key, experience_form)
682
682
  HttpClient::Preconditions.assert_class('organization', organization, String)
683
683
  HttpClient::Preconditions.assert_class('key', key, String)
684
- HttpClient::Preconditions.assert_class('experience_form', experience_form, ::Io::Flow::V0::Models::ExperienceForm)
684
+ (x = experience_form; x.is_a?(::Io::Flow::V0::Models::ExperienceForm) ? x : ::Io::Flow::V0::Models::ExperienceForm.new(x))
685
685
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}").with_json(experience_form.to_json).put
686
686
  ::Io::Flow::V0::Models::Experience.new(r)
687
687
  end
@@ -716,7 +716,7 @@ module Io
716
716
  def put_pricing_by_key(organization, key, pricing)
717
717
  HttpClient::Preconditions.assert_class('organization', organization, String)
718
718
  HttpClient::Preconditions.assert_class('key', key, String)
719
- HttpClient::Preconditions.assert_class('pricing', pricing, ::Io::Flow::V0::Models::Pricing)
719
+ (x = pricing; x.is_a?(::Io::Flow::V0::Models::Pricing) ? x : ::Io::Flow::V0::Models::Pricing.new(x))
720
720
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/pricing").with_json(pricing.to_json).put
721
721
  ::Io::Flow::V0::Models::Pricing.new(r)
722
722
  end
@@ -844,7 +844,7 @@ module Io
844
844
  # Add catalog item(s)
845
845
  def post(organization, item_form)
846
846
  HttpClient::Preconditions.assert_class('organization', organization, String)
847
- HttpClient::Preconditions.assert_class('item_form', item_form, ::Io::Flow::V0::Models::ItemForm)
847
+ (x = item_form; x.is_a?(::Io::Flow::V0::Models::ItemForm) ? x : ::Io::Flow::V0::Models::ItemForm.new(x))
848
848
  r = @client.request("/#{CGI.escape(organization)}/catalog/items").with_json(item_form.to_json).post
849
849
  ::Io::Flow::V0::Models::Item.new(r)
850
850
  end
@@ -861,7 +861,7 @@ module Io
861
861
  def put_by_number(organization, number, item_form)
862
862
  HttpClient::Preconditions.assert_class('organization', organization, String)
863
863
  HttpClient::Preconditions.assert_class('number', number, String)
864
- HttpClient::Preconditions.assert_class('item_form', item_form, ::Io::Flow::V0::Models::ItemForm)
864
+ (x = item_form; x.is_a?(::Io::Flow::V0::Models::ItemForm) ? x : ::Io::Flow::V0::Models::ItemForm.new(x))
865
865
  r = @client.request("/#{CGI.escape(organization)}/catalog/items/#{CGI.escape(number)}").with_json(item_form.to_json).put
866
866
  ::Io::Flow::V0::Models::Item.new(r)
867
867
  end
@@ -928,7 +928,7 @@ module Io
928
928
  :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)),
929
929
  :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
930
930
  }.delete_if { |k, v| v.nil? }
931
- HttpClient::Preconditions.assert_class('order_form', order_form, ::Io::Flow::V0::Models::OrderForm)
931
+ (x = order_form; x.is_a?(::Io::Flow::V0::Models::OrderForm) ? x : ::Io::Flow::V0::Models::OrderForm.new(x))
932
932
  r = @client.request("/#{CGI.escape(organization)}/orders").with_query(query).with_json(order_form.to_json).post
933
933
  ::Io::Flow::V0::Models::Order.new(r)
934
934
  end
@@ -960,7 +960,7 @@ module Io
960
960
  :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)),
961
961
  :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
962
962
  }.delete_if { |k, v| v.nil? }
963
- HttpClient::Preconditions.assert_class('order_put_form', order_put_form, ::Io::Flow::V0::Models::OrderPutForm)
963
+ (x = order_put_form; x.is_a?(::Io::Flow::V0::Models::OrderPutForm) ? x : ::Io::Flow::V0::Models::OrderPutForm.new(x))
964
964
  r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}").with_query(query).with_json(order_put_form.to_json).put
965
965
  ::Io::Flow::V0::Models::Order.new(r)
966
966
  end
@@ -1035,7 +1035,7 @@ module Io
1035
1035
  :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)),
1036
1036
  :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
1037
1037
  }.delete_if { |k, v| v.nil? }
1038
- HttpClient::Preconditions.assert_class('order_estimate_form', order_estimate_form, ::Io::Flow::V0::Models::OrderEstimateForm)
1038
+ (x = order_estimate_form; x.is_a?(::Io::Flow::V0::Models::OrderEstimateForm) ? x : ::Io::Flow::V0::Models::OrderEstimateForm.new(x))
1039
1039
  r = @client.request("/#{CGI.escape(organization)}/order-estimates").with_query(query).with_json(order_estimate_form.to_json).post
1040
1040
  ::Io::Flow::V0::Models::OrderEstimate.new(r)
1041
1041
  end
@@ -1058,7 +1058,7 @@ module Io
1058
1058
  :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)),
1059
1059
  :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
1060
1060
  }.delete_if { |k, v| v.nil? }
1061
- HttpClient::Preconditions.assert_class('order_estimate_form', order_estimate_form, ::Io::Flow::V0::Models::OrderEstimateForm)
1061
+ (x = order_estimate_form; x.is_a?(::Io::Flow::V0::Models::OrderEstimateForm) ? x : ::Io::Flow::V0::Models::OrderEstimateForm.new(x))
1062
1062
  r = @client.request("/#{CGI.escape(organization)}/order-estimates/#{CGI.escape(id)}").with_query(query).with_json(order_estimate_form.to_json).put
1063
1063
  ::Io::Flow::V0::Models::OrderEstimate.new(r)
1064
1064
  end
@@ -1088,7 +1088,7 @@ module Io
1088
1088
 
1089
1089
  def post(organization, order_identifier_form)
1090
1090
  HttpClient::Preconditions.assert_class('organization', organization, String)
1091
- HttpClient::Preconditions.assert_class('order_identifier_form', order_identifier_form, ::Io::Flow::V0::Models::OrderIdentifierForm)
1091
+ (x = order_identifier_form; x.is_a?(::Io::Flow::V0::Models::OrderIdentifierForm) ? x : ::Io::Flow::V0::Models::OrderIdentifierForm.new(x))
1092
1092
  r = @client.request("/#{CGI.escape(organization)}/order-identifiers").with_json(order_identifier_form.to_json).post
1093
1093
  ::Io::Flow::V0::Models::OrderIdentifier.new(r)
1094
1094
  end
@@ -1103,7 +1103,7 @@ module Io
1103
1103
  def put_by_number(organization, number, order_identifier_put_form)
1104
1104
  HttpClient::Preconditions.assert_class('organization', organization, String)
1105
1105
  HttpClient::Preconditions.assert_class('number', number, String)
1106
- HttpClient::Preconditions.assert_class('order_identifier_put_form', order_identifier_put_form, ::Io::Flow::V0::Models::OrderIdentifierPutForm)
1106
+ (x = order_identifier_put_form; x.is_a?(::Io::Flow::V0::Models::OrderIdentifierPutForm) ? x : ::Io::Flow::V0::Models::OrderIdentifierPutForm.new(x))
1107
1107
  r = @client.request("/#{CGI.escape(organization)}/order-identifiers/#{CGI.escape(number)}").with_json(order_identifier_put_form.to_json).put
1108
1108
  ::Io::Flow::V0::Models::OrderIdentifier.new(r)
1109
1109
  end
@@ -1178,7 +1178,7 @@ module Io
1178
1178
 
1179
1179
  # Create a new organization.
1180
1180
  def post(organization_form)
1181
- HttpClient::Preconditions.assert_class('organization_form', organization_form, ::Io::Flow::V0::Models::OrganizationForm)
1181
+ (x = organization_form; x.is_a?(::Io::Flow::V0::Models::OrganizationForm) ? x : ::Io::Flow::V0::Models::OrganizationForm.new(x))
1182
1182
  r = @client.request("/organizations").with_json(organization_form.to_json).post
1183
1183
  ::Io::Flow::V0::Models::Organization.new(r)
1184
1184
  end
@@ -1193,7 +1193,7 @@ module Io
1193
1193
  # Update or create an organization with the specified id.
1194
1194
  def put_by_id(id, organization_put_form)
1195
1195
  HttpClient::Preconditions.assert_class('id', id, String)
1196
- HttpClient::Preconditions.assert_class('organization_put_form', organization_put_form, ::Io::Flow::V0::Models::OrganizationPutForm)
1196
+ (x = organization_put_form; x.is_a?(::Io::Flow::V0::Models::OrganizationPutForm) ? x : ::Io::Flow::V0::Models::OrganizationPutForm.new(x))
1197
1197
  r = @client.request("/organizations/#{CGI.escape(id)}").with_json(organization_put_form.to_json).put
1198
1198
  ::Io::Flow::V0::Models::Organization.new(r)
1199
1199
  end
@@ -1236,7 +1236,7 @@ module Io
1236
1236
 
1237
1237
  def post_validations(organization, values)
1238
1238
  HttpClient::Preconditions.assert_class('organization', organization, String)
1239
- HttpClient::Preconditions.assert_collection_of_class('strings', strings, ::Io::Flow::V0::Models::String)
1239
+ HttpClient::Preconditions.assert_class('strings', strings, Array).map { |v| HttpClient::Preconditions.assert_class('strings', v, String) }
1240
1240
  r = @client.request("/#{CGI.escape(organization)}/query/validations").with_json(strings.to_json).post
1241
1241
  ::Io::Flow::V0::Models::QueryValidation.new(r)
1242
1242
  end
@@ -1266,7 +1266,7 @@ module Io
1266
1266
  # Add subcatalog
1267
1267
  def post(organization, subcatalog_form)
1268
1268
  HttpClient::Preconditions.assert_class('organization', organization, String)
1269
- HttpClient::Preconditions.assert_class('subcatalog_form', subcatalog_form, ::Io::Flow::V0::Models::SubcatalogForm)
1269
+ (x = subcatalog_form; x.is_a?(::Io::Flow::V0::Models::SubcatalogForm) ? x : ::Io::Flow::V0::Models::SubcatalogForm.new(x))
1270
1270
  r = @client.request("/#{CGI.escape(organization)}/catalog/subcatalogs").with_json(subcatalog_form.to_json).post
1271
1271
  ::Io::Flow::V0::Models::Subcatalog.new(r)
1272
1272
  end
@@ -1283,7 +1283,7 @@ module Io
1283
1283
  def put_by_id(organization, id, subcatalog_form)
1284
1284
  HttpClient::Preconditions.assert_class('organization', organization, String)
1285
1285
  HttpClient::Preconditions.assert_class('id', id, String)
1286
- HttpClient::Preconditions.assert_class('subcatalog_form', subcatalog_form, ::Io::Flow::V0::Models::SubcatalogForm)
1286
+ (x = subcatalog_form; x.is_a?(::Io::Flow::V0::Models::SubcatalogForm) ? x : ::Io::Flow::V0::Models::SubcatalogForm.new(x))
1287
1287
  r = @client.request("/#{CGI.escape(organization)}/catalog/subcatalogs/#{CGI.escape(id)}").with_json(subcatalog_form.to_json).put
1288
1288
  ::Io::Flow::V0::Models::Subcatalog.new(r)
1289
1289
  end
@@ -1308,7 +1308,7 @@ module Io
1308
1308
  def put_settings_by_id(organization, id, subcatalog_settings_form)
1309
1309
  HttpClient::Preconditions.assert_class('organization', organization, String)
1310
1310
  HttpClient::Preconditions.assert_class('id', id, String)
1311
- HttpClient::Preconditions.assert_class('subcatalog_settings_form', subcatalog_settings_form, ::Io::Flow::V0::Models::SubcatalogSettingsForm)
1311
+ (x = subcatalog_settings_form; x.is_a?(::Io::Flow::V0::Models::SubcatalogSettingsForm) ? x : ::Io::Flow::V0::Models::SubcatalogSettingsForm.new(x))
1312
1312
  r = @client.request("/#{CGI.escape(organization)}/catalog/subcatalogs/#{CGI.escape(id)}/settings").with_json(subcatalog_settings_form.to_json).put
1313
1313
  ::Io::Flow::V0::Models::SubcatalogSettings.new(r)
1314
1314
  end
@@ -1376,7 +1376,7 @@ module Io
1376
1376
  def post_functions_by_subcatalog_id(organization, subcatalog_id, subcatalog_function_form)
1377
1377
  HttpClient::Preconditions.assert_class('organization', organization, String)
1378
1378
  HttpClient::Preconditions.assert_class('subcatalog_id', subcatalog_id, String)
1379
- HttpClient::Preconditions.assert_class('subcatalog_function_form', subcatalog_function_form, ::Io::Flow::V0::Models::SubcatalogFunctionForm)
1379
+ (x = subcatalog_function_form; x.is_a?(::Io::Flow::V0::Models::SubcatalogFunctionForm) ? x : ::Io::Flow::V0::Models::SubcatalogFunctionForm.new(x))
1380
1380
  r = @client.request("/#{CGI.escape(organization)}/catalog/subcatalogs/#{CGI.escape(subcatalog_id)}/functions").with_json(subcatalog_function_form.to_json).post
1381
1381
  ::Io::Flow::V0::Models::SubcatalogFunction.new(r)
1382
1382
  end
@@ -1479,7 +1479,7 @@ module Io
1479
1479
  def post_queries_by_subcatalog_id(organization, subcatalog_id, query_form)
1480
1480
  HttpClient::Preconditions.assert_class('organization', organization, String)
1481
1481
  HttpClient::Preconditions.assert_class('subcatalog_id', subcatalog_id, String)
1482
- HttpClient::Preconditions.assert_class('query_form', query_form, ::Io::Flow::V0::Models::QueryForm)
1482
+ (x = query_form; x.is_a?(::Io::Flow::V0::Models::QueryForm) ? x : ::Io::Flow::V0::Models::QueryForm.new(x))
1483
1483
  r = @client.request("/#{CGI.escape(organization)}/catalog/subcatalogs/#{CGI.escape(subcatalog_id)}/queries").with_json(query_form.to_json).post
1484
1484
  ::Io::Flow::V0::Models::Query.new(r)
1485
1485
  end
@@ -1599,7 +1599,7 @@ module Io
1599
1599
 
1600
1600
  def post(organization, targeting_form)
1601
1601
  HttpClient::Preconditions.assert_class('organization', organization, String)
1602
- HttpClient::Preconditions.assert_class('targeting_form', targeting_form, ::Io::Flow::V0::Models::TargetingForm)
1602
+ (x = targeting_form; x.is_a?(::Io::Flow::V0::Models::TargetingForm) ? x : ::Io::Flow::V0::Models::TargetingForm.new(x))
1603
1603
  r = @client.request("/#{CGI.escape(organization)}/catalog/targetings").with_json(targeting_form.to_json).post
1604
1604
  ::Io::Flow::V0::Models::Targeting.new(r)
1605
1605
  end
@@ -1614,7 +1614,7 @@ module Io
1614
1614
  def put_by_key(organization, key, targeting_form)
1615
1615
  HttpClient::Preconditions.assert_class('organization', organization, String)
1616
1616
  HttpClient::Preconditions.assert_class('key', key, String)
1617
- HttpClient::Preconditions.assert_class('targeting_form', targeting_form, ::Io::Flow::V0::Models::TargetingForm)
1617
+ (x = targeting_form; x.is_a?(::Io::Flow::V0::Models::TargetingForm) ? x : ::Io::Flow::V0::Models::TargetingForm.new(x))
1618
1618
  r = @client.request("/#{CGI.escape(organization)}/catalog/targetings/#{CGI.escape(key)}").with_json(targeting_form.to_json).put
1619
1619
  ::Io::Flow::V0::Models::Targeting.new(r)
1620
1620
  end
@@ -1689,7 +1689,7 @@ module Io
1689
1689
  # Create item function
1690
1690
  def post(organization, item_function_post_form)
1691
1691
  HttpClient::Preconditions.assert_class('organization', organization, String)
1692
- HttpClient::Preconditions.assert_class('item_function_post_form', item_function_post_form, ::Io::Flow::V0::Models::ItemFunctionPostForm)
1692
+ (x = item_function_post_form; x.is_a?(::Io::Flow::V0::Models::ItemFunctionPostForm) ? x : ::Io::Flow::V0::Models::ItemFunctionPostForm.new(x))
1693
1693
  r = @client.request("/#{CGI.escape(organization)}/item-functions").with_json(item_function_post_form.to_json).post
1694
1694
  ::Io::Flow::V0::Models::ItemFunction.new(r)
1695
1695
  end
@@ -1706,7 +1706,7 @@ module Io
1706
1706
  def put_by_key(organization, key, item_function_put_form)
1707
1707
  HttpClient::Preconditions.assert_class('organization', organization, String)
1708
1708
  HttpClient::Preconditions.assert_class('key', key, String)
1709
- HttpClient::Preconditions.assert_class('item_function_put_form', item_function_put_form, ::Io::Flow::V0::Models::ItemFunctionPutForm)
1709
+ (x = item_function_put_form; x.is_a?(::Io::Flow::V0::Models::ItemFunctionPutForm) ? x : ::Io::Flow::V0::Models::ItemFunctionPutForm.new(x))
1710
1710
  r = @client.request("/#{CGI.escape(organization)}/item-functions/#{CGI.escape(key)}").with_json(item_function_put_form.to_json).put
1711
1711
  ::Io::Flow::V0::Models::ItemFunction.new(r)
1712
1712
  end
@@ -1760,7 +1760,7 @@ module Io
1760
1760
  # Create organization currency settings.
1761
1761
  def post(organization, organization_currency_setting_form)
1762
1762
  HttpClient::Preconditions.assert_class('organization', organization, String)
1763
- HttpClient::Preconditions.assert_class('organization_currency_setting_form', organization_currency_setting_form, ::Io::Flow::V0::Models::OrganizationCurrencySettingForm)
1763
+ (x = organization_currency_setting_form; x.is_a?(::Io::Flow::V0::Models::OrganizationCurrencySettingForm) ? x : ::Io::Flow::V0::Models::OrganizationCurrencySettingForm.new(x))
1764
1764
  r = @client.request("/#{CGI.escape(organization)}/currency/settings").with_json(organization_currency_setting_form.to_json).post
1765
1765
  ::Io::Flow::V0::Models::OrganizationCurrencySetting.new(r)
1766
1766
  end
@@ -1776,7 +1776,7 @@ module Io
1776
1776
  def put_by_id(organization, id, organization_currency_setting_form)
1777
1777
  HttpClient::Preconditions.assert_class('organization', organization, String)
1778
1778
  HttpClient::Preconditions.assert_class('id', id, String)
1779
- HttpClient::Preconditions.assert_class('organization_currency_setting_form', organization_currency_setting_form, ::Io::Flow::V0::Models::OrganizationCurrencySettingForm)
1779
+ (x = organization_currency_setting_form; x.is_a?(::Io::Flow::V0::Models::OrganizationCurrencySettingForm) ? x : ::Io::Flow::V0::Models::OrganizationCurrencySettingForm.new(x))
1780
1780
  r = @client.request("/#{CGI.escape(organization)}/currency/settings/#{CGI.escape(id)}").with_json(organization_currency_setting_form.to_json).put
1781
1781
  ::Io::Flow::V0::Models::OrganizationCurrencySetting.new(r)
1782
1782
  end
@@ -1859,7 +1859,7 @@ module Io
1859
1859
 
1860
1860
  def put(organization, harmonization_settings_form)
1861
1861
  HttpClient::Preconditions.assert_class('organization', organization, String)
1862
- HttpClient::Preconditions.assert_class('harmonization_settings_form', harmonization_settings_form, ::Io::Flow::V0::Models::HarmonizationSettingsForm)
1862
+ (x = harmonization_settings_form; x.is_a?(::Io::Flow::V0::Models::HarmonizationSettingsForm) ? x : ::Io::Flow::V0::Models::HarmonizationSettingsForm.new(x))
1863
1863
  r = @client.request("/#{CGI.escape(organization)}/harmonization/settings").with_json(harmonization_settings_form.to_json).put
1864
1864
  ::Io::Flow::V0::Models::HarmonizationSettings.new(r)
1865
1865
  end
@@ -1909,7 +1909,7 @@ module Io
1909
1909
 
1910
1910
  def post(organization, harmonized_item_form)
1911
1911
  HttpClient::Preconditions.assert_class('organization', organization, String)
1912
- HttpClient::Preconditions.assert_class('harmonized_item_form', harmonized_item_form, ::Io::Flow::V0::Models::HarmonizedItemForm)
1912
+ (x = harmonized_item_form; x.is_a?(::Io::Flow::V0::Models::HarmonizedItemForm) ? x : ::Io::Flow::V0::Models::HarmonizedItemForm.new(x))
1913
1913
  r = @client.request("/#{CGI.escape(organization)}/harmonization/items").with_json(harmonized_item_form.to_json).post
1914
1914
  ::Io::Flow::V0::Models::HarmonizedItem.new(r)
1915
1915
  end
@@ -1925,7 +1925,7 @@ module Io
1925
1925
  def put_by_number(organization, number, harmonized_item_put_form)
1926
1926
  HttpClient::Preconditions.assert_class('organization', organization, String)
1927
1927
  HttpClient::Preconditions.assert_class('number', number, String)
1928
- HttpClient::Preconditions.assert_class('harmonized_item_put_form', harmonized_item_put_form, ::Io::Flow::V0::Models::HarmonizedItemPutForm)
1928
+ (x = harmonized_item_put_form; x.is_a?(::Io::Flow::V0::Models::HarmonizedItemPutForm) ? x : ::Io::Flow::V0::Models::HarmonizedItemPutForm.new(x))
1929
1929
  r = @client.request("/#{CGI.escape(organization)}/harmonization/items/#{CGI.escape(number)}").with_json(harmonized_item_put_form.to_json).put
1930
1930
  ::Io::Flow::V0::Models::HarmonizedItem.new(r)
1931
1931
  end
@@ -1978,7 +1978,7 @@ module Io
1978
1978
 
1979
1979
  def post(organization, harmonized_item_duty_form)
1980
1980
  HttpClient::Preconditions.assert_class('organization', organization, String)
1981
- HttpClient::Preconditions.assert_class('harmonized_item_duty_form', harmonized_item_duty_form, ::Io::Flow::V0::Models::HarmonizedItemDutyForm)
1981
+ (x = harmonized_item_duty_form; x.is_a?(::Io::Flow::V0::Models::HarmonizedItemDutyForm) ? x : ::Io::Flow::V0::Models::HarmonizedItemDutyForm.new(x))
1982
1982
  r = @client.request("/#{CGI.escape(organization)}/harmonization/item-duties").with_json(harmonized_item_duty_form.to_json).post
1983
1983
  ::Io::Flow::V0::Models::HarmonizedItemDuty.new(r)
1984
1984
  end
@@ -2026,7 +2026,7 @@ module Io
2026
2026
  # collection of items
2027
2027
  def post(organization, harmonized_landed_cost_form)
2028
2028
  HttpClient::Preconditions.assert_class('organization', organization, String)
2029
- HttpClient::Preconditions.assert_class('harmonized_landed_cost_form', harmonized_landed_cost_form, ::Io::Flow::V0::Models::HarmonizedLandedCostForm)
2029
+ (x = harmonized_landed_cost_form; x.is_a?(::Io::Flow::V0::Models::HarmonizedLandedCostForm) ? x : ::Io::Flow::V0::Models::HarmonizedLandedCostForm.new(x))
2030
2030
  r = @client.request("/#{CGI.escape(organization)}/harmonization/landed-costs").with_json(harmonized_landed_cost_form.to_json).post
2031
2031
  ::Io::Flow::V0::Models::HarmonizedLandedCost.new(r)
2032
2032
  end
@@ -2170,7 +2170,7 @@ module Io
2170
2170
  query = {
2171
2171
  :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
2172
2172
  }.delete_if { |k, v| v.nil? }
2173
- HttpClient::Preconditions.assert_class('authorization_form', authorization_form, ::Io::Flow::V0::Models::AuthorizationForm)
2173
+ (x = authorization_form; x.is_a?(::Io::Flow::V0::Models::AuthorizationForm) ? x : ::Io::Flow::V0::Models::AuthorizationForm.from_json(x))
2174
2174
  r = @client.request("/#{CGI.escape(organization)}/authorizations").with_query(query).with_json(authorization_form.to_json).post
2175
2175
  ::Io::Flow::V0::Models::Authorization.from_json(r)
2176
2176
  end
@@ -2238,7 +2238,7 @@ module Io
2238
2238
  # Create a new capture.
2239
2239
  def post(organization, capture_form)
2240
2240
  HttpClient::Preconditions.assert_class('organization', organization, String)
2241
- HttpClient::Preconditions.assert_class('capture_form', capture_form, ::Io::Flow::V0::Models::CaptureForm)
2241
+ (x = capture_form; x.is_a?(::Io::Flow::V0::Models::CaptureForm) ? x : ::Io::Flow::V0::Models::CaptureForm.new(x))
2242
2242
  r = @client.request("/#{CGI.escape(organization)}/captures").with_json(capture_form.to_json).post
2243
2243
  ::Io::Flow::V0::Models::Capture.new(r)
2244
2244
  end
@@ -2292,7 +2292,7 @@ module Io
2292
2292
  # need to authenticate.
2293
2293
  def post(organization, card_form)
2294
2294
  HttpClient::Preconditions.assert_class('organization', organization, String)
2295
- HttpClient::Preconditions.assert_class('card_form', card_form, ::Io::Flow::V0::Models::CardForm)
2295
+ (x = card_form; x.is_a?(::Io::Flow::V0::Models::CardForm) ? x : ::Io::Flow::V0::Models::CardForm.new(x))
2296
2296
  r = @client.request("/#{CGI.escape(organization)}/cards").with_json(card_form.to_json).post
2297
2297
  ::Io::Flow::V0::Models::Card.new(r)
2298
2298
  end
@@ -2318,7 +2318,7 @@ module Io
2318
2318
  # exchanged.
2319
2319
  def post_nonces(organization, card_nonce_form)
2320
2320
  HttpClient::Preconditions.assert_class('organization', organization, String)
2321
- HttpClient::Preconditions.assert_class('card_nonce_form', card_nonce_form, ::Io::Flow::V0::Models::CardNonceForm)
2321
+ (x = card_nonce_form; x.is_a?(::Io::Flow::V0::Models::CardNonceForm) ? x : ::Io::Flow::V0::Models::CardNonceForm.new(x))
2322
2322
  r = @client.request("/#{CGI.escape(organization)}/cards/nonces").with_json(card_nonce_form.to_json).post
2323
2323
  ::Io::Flow::V0::Models::Card.new(r)
2324
2324
  end
@@ -2365,7 +2365,7 @@ module Io
2365
2365
  # not need to authenticate.
2366
2366
  def post(organization, payment_form)
2367
2367
  HttpClient::Preconditions.assert_class('organization', organization, String)
2368
- HttpClient::Preconditions.assert_class('payment_form', payment_form, ::Io::Flow::V0::Models::PaymentForm)
2368
+ (x = payment_form; x.is_a?(::Io::Flow::V0::Models::PaymentForm) ? x : ::Io::Flow::V0::Models::PaymentForm.from_json(x))
2369
2369
  r = @client.request("/#{CGI.escape(organization)}/payments").with_json(payment_form.to_json).post
2370
2370
  ::Io::Flow::V0::Models::Payment.from_json(r)
2371
2371
  end
@@ -2459,7 +2459,7 @@ module Io
2459
2459
  # Create a new refund.
2460
2460
  def post(organization, refund_form)
2461
2461
  HttpClient::Preconditions.assert_class('organization', organization, String)
2462
- HttpClient::Preconditions.assert_class('refund_form', refund_form, ::Io::Flow::V0::Models::RefundForm)
2462
+ (x = refund_form; x.is_a?(::Io::Flow::V0::Models::RefundForm) ? x : ::Io::Flow::V0::Models::RefundForm.new(x))
2463
2463
  r = @client.request("/#{CGI.escape(organization)}/refunds").with_json(refund_form.to_json).post
2464
2464
  ::Io::Flow::V0::Models::Refund.new(r)
2465
2465
  end
@@ -2519,7 +2519,7 @@ module Io
2519
2519
 
2520
2520
  def post(organization, center_form)
2521
2521
  HttpClient::Preconditions.assert_class('organization', organization, String)
2522
- HttpClient::Preconditions.assert_class('center_form', center_form, ::Io::Flow::V0::Models::CenterForm)
2522
+ (x = center_form; x.is_a?(::Io::Flow::V0::Models::CenterForm) ? x : ::Io::Flow::V0::Models::CenterForm.new(x))
2523
2523
  r = @client.request("/#{CGI.escape(organization)}/centers").with_json(center_form.to_json).post
2524
2524
  ::Io::Flow::V0::Models::Center.new(r)
2525
2525
  end
@@ -2534,7 +2534,7 @@ module Io
2534
2534
  def put_by_key(organization, key, center_form)
2535
2535
  HttpClient::Preconditions.assert_class('organization', organization, String)
2536
2536
  HttpClient::Preconditions.assert_class('key', key, String)
2537
- HttpClient::Preconditions.assert_class('center_form', center_form, ::Io::Flow::V0::Models::CenterForm)
2537
+ (x = center_form; x.is_a?(::Io::Flow::V0::Models::CenterForm) ? x : ::Io::Flow::V0::Models::CenterForm.new(x))
2538
2538
  r = @client.request("/#{CGI.escape(organization)}/centers/#{CGI.escape(key)}").with_json(center_form.to_json).put
2539
2539
  ::Io::Flow::V0::Models::Center.new(r)
2540
2540
  end
@@ -2606,7 +2606,7 @@ module Io
2606
2606
 
2607
2607
  def post(organization, inventory_rule_form)
2608
2608
  HttpClient::Preconditions.assert_class('organization', organization, String)
2609
- HttpClient::Preconditions.assert_class('inventory_rule_form', inventory_rule_form, ::Io::Flow::V0::Models::InventoryRuleForm)
2609
+ (x = inventory_rule_form; x.is_a?(::Io::Flow::V0::Models::InventoryRuleForm) ? x : ::Io::Flow::V0::Models::InventoryRuleForm.new(x))
2610
2610
  r = @client.request("/#{CGI.escape(organization)}/inventory_rules").with_json(inventory_rule_form.to_json).post
2611
2611
  ::Io::Flow::V0::Models::InventoryRule.new(r)
2612
2612
  end
@@ -2693,7 +2693,7 @@ module Io
2693
2693
 
2694
2694
  def post(organization, inventory_update_form)
2695
2695
  HttpClient::Preconditions.assert_class('organization', organization, String)
2696
- HttpClient::Preconditions.assert_class('inventory_update_form', inventory_update_form, ::Io::Flow::V0::Models::InventoryUpdateForm)
2696
+ (x = inventory_update_form; x.is_a?(::Io::Flow::V0::Models::InventoryUpdateForm) ? x : ::Io::Flow::V0::Models::InventoryUpdateForm.new(x))
2697
2697
  r = @client.request("/#{CGI.escape(organization)}/inventory_updates").with_json(inventory_update_form.to_json).post
2698
2698
  ::Io::Flow::V0::Models::InventoryUpdate.new(r)
2699
2699
  end
@@ -2743,7 +2743,7 @@ module Io
2743
2743
 
2744
2744
  def post(organization, quote_form)
2745
2745
  HttpClient::Preconditions.assert_class('organization', organization, String)
2746
- HttpClient::Preconditions.assert_class('quote_form', quote_form, ::Io::Flow::V0::Models::QuoteForm)
2746
+ (x = quote_form; x.is_a?(::Io::Flow::V0::Models::QuoteForm) ? x : ::Io::Flow::V0::Models::QuoteForm.new(x))
2747
2747
  r = @client.request("/#{CGI.escape(organization)}/quotes").with_json(quote_form.to_json).post
2748
2748
  ::Io::Flow::V0::Models::Quote.new(r)
2749
2749
  end
@@ -2797,7 +2797,7 @@ module Io
2797
2797
 
2798
2798
  def post(organization, return_form)
2799
2799
  HttpClient::Preconditions.assert_class('organization', organization, String)
2800
- HttpClient::Preconditions.assert_class('return_form', return_form, ::Io::Flow::V0::Models::ReturnForm)
2800
+ (x = return_form; x.is_a?(::Io::Flow::V0::Models::ReturnForm) ? x : ::Io::Flow::V0::Models::ReturnForm.new(x))
2801
2801
  r = @client.request("/#{CGI.escape(organization)}/returns").with_json(return_form.to_json).post
2802
2802
  ::Io::Flow::V0::Models::Return.new(r)
2803
2803
  end
@@ -2812,7 +2812,7 @@ module Io
2812
2812
  def put_by_key(organization, key, return_form)
2813
2813
  HttpClient::Preconditions.assert_class('organization', organization, String)
2814
2814
  HttpClient::Preconditions.assert_class('key', key, String)
2815
- HttpClient::Preconditions.assert_class('return_form', return_form, ::Io::Flow::V0::Models::ReturnForm)
2815
+ (x = return_form; x.is_a?(::Io::Flow::V0::Models::ReturnForm) ? x : ::Io::Flow::V0::Models::ReturnForm.new(x))
2816
2816
  r = @client.request("/#{CGI.escape(organization)}/returns/#{CGI.escape(key)}").with_json(return_form.to_json).put
2817
2817
  ::Io::Flow::V0::Models::Return.new(r)
2818
2818
  end
@@ -2865,7 +2865,7 @@ module Io
2865
2865
 
2866
2866
  def post(organization, shipping_label_form)
2867
2867
  HttpClient::Preconditions.assert_class('organization', organization, String)
2868
- HttpClient::Preconditions.assert_class('shipping_label_form', shipping_label_form, ::Io::Flow::V0::Models::ShippingLabelForm)
2868
+ (x = shipping_label_form; x.is_a?(::Io::Flow::V0::Models::ShippingLabelForm) ? x : ::Io::Flow::V0::Models::ShippingLabelForm.new(x))
2869
2869
  r = @client.request("/#{CGI.escape(organization)}/shipping_labels").with_json(shipping_label_form.to_json).post
2870
2870
  ::Io::Flow::V0::Models::ShippingLabel.new(r)
2871
2871
  end
@@ -2919,7 +2919,7 @@ module Io
2919
2919
 
2920
2920
  def post(organization, shipping_notification_form)
2921
2921
  HttpClient::Preconditions.assert_class('organization', organization, String)
2922
- HttpClient::Preconditions.assert_class('shipping_notification_form', shipping_notification_form, ::Io::Flow::V0::Models::ShippingNotificationForm)
2922
+ (x = shipping_notification_form; x.is_a?(::Io::Flow::V0::Models::ShippingNotificationForm) ? x : ::Io::Flow::V0::Models::ShippingNotificationForm.new(x))
2923
2923
  r = @client.request("/#{CGI.escape(organization)}/shipping-notifications").with_json(shipping_notification_form.to_json).post
2924
2924
  ::Io::Flow::V0::Models::ShippingNotification.new(r)
2925
2925
  end
@@ -2934,7 +2934,7 @@ module Io
2934
2934
  def put_by_key(organization, key, shipping_notification_form)
2935
2935
  HttpClient::Preconditions.assert_class('organization', organization, String)
2936
2936
  HttpClient::Preconditions.assert_class('key', key, String)
2937
- HttpClient::Preconditions.assert_class('shipping_notification_form', shipping_notification_form, ::Io::Flow::V0::Models::ShippingNotificationForm)
2937
+ (x = shipping_notification_form; x.is_a?(::Io::Flow::V0::Models::ShippingNotificationForm) ? x : ::Io::Flow::V0::Models::ShippingNotificationForm.new(x))
2938
2938
  r = @client.request("/#{CGI.escape(organization)}/shipping-notifications/#{CGI.escape(key)}").with_json(shipping_notification_form.to_json).put
2939
2939
  ::Io::Flow::V0::Models::ShippingNotification.new(r)
2940
2940
  end
@@ -2984,7 +2984,7 @@ module Io
2984
2984
 
2985
2985
  def post(organization, tier_form)
2986
2986
  HttpClient::Preconditions.assert_class('organization', organization, String)
2987
- HttpClient::Preconditions.assert_class('tier_form', tier_form, ::Io::Flow::V0::Models::TierForm)
2987
+ (x = tier_form; x.is_a?(::Io::Flow::V0::Models::TierForm) ? x : ::Io::Flow::V0::Models::TierForm.new(x))
2988
2988
  r = @client.request("/#{CGI.escape(organization)}/tiers").with_json(tier_form.to_json).post
2989
2989
  ::Io::Flow::V0::Models::Tier.new(r)
2990
2990
  end
@@ -2999,7 +2999,7 @@ module Io
2999
2999
  def put_by_id(organization, id, tier_form)
3000
3000
  HttpClient::Preconditions.assert_class('organization', organization, String)
3001
3001
  HttpClient::Preconditions.assert_class('id', id, String)
3002
- HttpClient::Preconditions.assert_class('tier_form', tier_form, ::Io::Flow::V0::Models::TierForm)
3002
+ (x = tier_form; x.is_a?(::Io::Flow::V0::Models::TierForm) ? x : ::Io::Flow::V0::Models::TierForm.new(x))
3003
3003
  r = @client.request("/#{CGI.escape(organization)}/tiers/#{CGI.escape(id)}").with_json(tier_form.to_json).put
3004
3004
  ::Io::Flow::V0::Models::Tier.new(r)
3005
3005
  end
@@ -3049,7 +3049,7 @@ module Io
3049
3049
 
3050
3050
  def post(organization, tier_default_form)
3051
3051
  HttpClient::Preconditions.assert_class('organization', organization, String)
3052
- HttpClient::Preconditions.assert_class('tier_default_form', tier_default_form, ::Io::Flow::V0::Models::TierDefaultForm)
3052
+ (x = tier_default_form; x.is_a?(::Io::Flow::V0::Models::TierDefaultForm) ? x : ::Io::Flow::V0::Models::TierDefaultForm.new(x))
3053
3053
  r = @client.request("/#{CGI.escape(organization)}/tier_defaults").with_json(tier_default_form.to_json).post
3054
3054
  ::Io::Flow::V0::Models::TierDefault.new(r)
3055
3055
  end
@@ -3100,7 +3100,7 @@ module Io
3100
3100
  def post(organization, tier_id, tier_rule_form)
3101
3101
  HttpClient::Preconditions.assert_class('organization', organization, String)
3102
3102
  HttpClient::Preconditions.assert_class('tier_id', tier_id, String)
3103
- HttpClient::Preconditions.assert_class('tier_rule_form', tier_rule_form, ::Io::Flow::V0::Models::TierRuleForm)
3103
+ (x = tier_rule_form; x.is_a?(::Io::Flow::V0::Models::TierRuleForm) ? x : ::Io::Flow::V0::Models::TierRuleForm.new(x))
3104
3104
  r = @client.request("/#{CGI.escape(organization)}/tiers/#{CGI.escape(tier_id)}/rules").with_json(tier_rule_form.to_json).post
3105
3105
  ::Io::Flow::V0::Models::TierRule.new(r)
3106
3106
  end
@@ -3117,7 +3117,7 @@ module Io
3117
3117
  HttpClient::Preconditions.assert_class('organization', organization, String)
3118
3118
  HttpClient::Preconditions.assert_class('tier_id', tier_id, String)
3119
3119
  HttpClient::Preconditions.assert_class('id', id, String)
3120
- HttpClient::Preconditions.assert_class('tier_rule_form', tier_rule_form, ::Io::Flow::V0::Models::TierRuleForm)
3120
+ (x = tier_rule_form; x.is_a?(::Io::Flow::V0::Models::TierRuleForm) ? x : ::Io::Flow::V0::Models::TierRuleForm.new(x))
3121
3121
  r = @client.request("/#{CGI.escape(organization)}/tiers/#{CGI.escape(tier_id)}/rules/#{CGI.escape(id)}").with_json(tier_rule_form.to_json).put
3122
3122
  ::Io::Flow::V0::Models::TierRule.new(r)
3123
3123
  end
@@ -3168,7 +3168,7 @@ module Io
3168
3168
 
3169
3169
  def post_trackings_by_organization(organization, tracking_form)
3170
3170
  HttpClient::Preconditions.assert_class('organization', organization, String)
3171
- HttpClient::Preconditions.assert_class('tracking_form', tracking_form, ::Io::Flow::V0::Models::TrackingForm)
3171
+ (x = tracking_form; x.is_a?(::Io::Flow::V0::Models::TrackingForm) ? x : ::Io::Flow::V0::Models::TrackingForm.new(x))
3172
3172
  r = @client.request("/#{CGI.escape(organization)}/trackings").with_json(tracking_form.to_json).post
3173
3173
  ::Io::Flow::V0::Models::Tracking.new(r)
3174
3174
  end
@@ -3263,7 +3263,7 @@ module Io
3263
3263
 
3264
3264
  def post(organization, tracking_label_form)
3265
3265
  HttpClient::Preconditions.assert_class('organization', organization, String)
3266
- HttpClient::Preconditions.assert_class('tracking_label_form', tracking_label_form, ::Io::Flow::V0::Models::TrackingLabelForm)
3266
+ (x = tracking_label_form; x.is_a?(::Io::Flow::V0::Models::TrackingLabelForm) ? x : ::Io::Flow::V0::Models::TrackingLabelForm.new(x))
3267
3267
  r = @client.request("/#{CGI.escape(organization)}/tracking-labels").with_json(tracking_label_form.to_json).post
3268
3268
  ::Io::Flow::V0::Models::TrackingLabel.new(r)
3269
3269
  end
@@ -3314,7 +3314,7 @@ module Io
3314
3314
  # Create a new webhook
3315
3315
  def post(organization, webhook_form)
3316
3316
  HttpClient::Preconditions.assert_class('organization', organization, String)
3317
- HttpClient::Preconditions.assert_class('webhook_form', webhook_form, ::Io::Flow::V0::Models::WebhookForm)
3317
+ (x = webhook_form; x.is_a?(::Io::Flow::V0::Models::WebhookForm) ? x : ::Io::Flow::V0::Models::WebhookForm.new(x))
3318
3318
  r = @client.request("/#{CGI.escape(organization)}/webhooks").with_json(webhook_form.to_json).post
3319
3319
  ::Io::Flow::V0::Models::Webhook.new(r)
3320
3320
  end
@@ -3331,7 +3331,7 @@ module Io
3331
3331
  def put_by_id(organization, id, webhook_form)
3332
3332
  HttpClient::Preconditions.assert_class('organization', organization, String)
3333
3333
  HttpClient::Preconditions.assert_class('id', id, String)
3334
- HttpClient::Preconditions.assert_class('webhook_form', webhook_form, ::Io::Flow::V0::Models::WebhookForm)
3334
+ (x = webhook_form; x.is_a?(::Io::Flow::V0::Models::WebhookForm) ? x : ::Io::Flow::V0::Models::WebhookForm.new(x))
3335
3335
  r = @client.request("/#{CGI.escape(organization)}/webhooks/#{CGI.escape(id)}").with_json(webhook_form.to_json).put
3336
3336
  ::Io::Flow::V0::Models::Webhook.new(r)
3337
3337
  end
@@ -3354,7 +3354,7 @@ module Io
3354
3354
  # Updates the webhook settings for an organization
3355
3355
  def put_settings(organization, webhook_settings)
3356
3356
  HttpClient::Preconditions.assert_class('organization', organization, String)
3357
- HttpClient::Preconditions.assert_class('webhook_settings', webhook_settings, ::Io::Flow::V0::Models::WebhookSettings)
3357
+ (x = webhook_settings; x.is_a?(::Io::Flow::V0::Models::WebhookSettings) ? x : ::Io::Flow::V0::Models::WebhookSettings.new(x))
3358
3358
  r = @client.request("/#{CGI.escape(organization)}/webhooks/settings").with_json(webhook_settings.to_json).put
3359
3359
  ::Io::Flow::V0::Models::WebhookSettings.new(r)
3360
3360
  end
@@ -3421,7 +3421,7 @@ module Io
3421
3421
  end
3422
3422
 
3423
3423
  def post_verifications(address)
3424
- HttpClient::Preconditions.assert_class('address', address, ::Io::Flow::V0::Models::Address)
3424
+ (x = address; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
3425
3425
  r = @client.request("/addresses/verifications").with_json(address.to_json).post
3426
3426
  ::Io::Flow::V0::Models::AddressVerification.new(r)
3427
3427
  end
@@ -3706,7 +3706,7 @@ module Io
3706
3706
  # Create an export.
3707
3707
  def post(organization, export_form)
3708
3708
  HttpClient::Preconditions.assert_class('organization', organization, String)
3709
- HttpClient::Preconditions.assert_class('export_form', export_form, ::Io::Flow::V0::Models::ExportForm)
3709
+ (x = export_form; x.is_a?(::Io::Flow::V0::Models::ExportForm) ? x : ::Io::Flow::V0::Models::ExportForm.new(x))
3710
3710
  r = @client.request("/#{CGI.escape(organization)}/exports").with_json(export_form.to_json).post
3711
3711
  ::Io::Flow::V0::Models::Export.new(r)
3712
3712
  end
@@ -3771,7 +3771,7 @@ module Io
3771
3771
 
3772
3772
  def post_catalog(organization, catalog_feed_form_post)
3773
3773
  HttpClient::Preconditions.assert_class('organization', organization, String)
3774
- HttpClient::Preconditions.assert_class('catalog_feed_form_post', catalog_feed_form_post, ::Io::Flow::V0::Models::CatalogFeedFormPost)
3774
+ (x = catalog_feed_form_post; x.is_a?(::Io::Flow::V0::Models::CatalogFeedFormPost) ? x : ::Io::Flow::V0::Models::CatalogFeedFormPost.new(x))
3775
3775
  r = @client.request("/#{CGI.escape(organization)}/feeds/catalog").with_json(catalog_feed_form_post.to_json).post
3776
3776
  ::Io::Flow::V0::Models::CatalogFeed.new(r)
3777
3777
  end
@@ -3779,7 +3779,7 @@ module Io
3779
3779
  def put_catalog_by_id(organization, id, catalog_feed_form_put)
3780
3780
  HttpClient::Preconditions.assert_class('organization', organization, String)
3781
3781
  HttpClient::Preconditions.assert_class('id', id, String)
3782
- HttpClient::Preconditions.assert_class('catalog_feed_form_put', catalog_feed_form_put, ::Io::Flow::V0::Models::CatalogFeedFormPut)
3782
+ (x = catalog_feed_form_put; x.is_a?(::Io::Flow::V0::Models::CatalogFeedFormPut) ? x : ::Io::Flow::V0::Models::CatalogFeedFormPut.new(x))
3783
3783
  r = @client.request("/#{CGI.escape(organization)}/feeds/catalog/#{CGI.escape(id)}").with_json(catalog_feed_form_put.to_json).put
3784
3784
  ::Io::Flow::V0::Models::CatalogFeed.new(r)
3785
3785
  end
@@ -3824,7 +3824,7 @@ module Io
3824
3824
  # Create an import.
3825
3825
  def post(organization, import_form)
3826
3826
  HttpClient::Preconditions.assert_class('organization', organization, String)
3827
- HttpClient::Preconditions.assert_class('import_form', import_form, ::Io::Flow::V0::Models::ImportForm)
3827
+ (x = import_form; x.is_a?(::Io::Flow::V0::Models::ImportForm) ? x : ::Io::Flow::V0::Models::ImportForm.new(x))
3828
3828
  r = @client.request("/#{CGI.escape(organization)}/imports").with_json(import_form.to_json).post
3829
3829
  ::Io::Flow::V0::Models::Import.new(r)
3830
3830
  end
@@ -3886,7 +3886,7 @@ module Io
3886
3886
 
3887
3887
  # Create a new invitation.
3888
3888
  def post(invitation_form)
3889
- HttpClient::Preconditions.assert_class('invitation_form', invitation_form, ::Io::Flow::V0::Models::InvitationForm)
3889
+ (x = invitation_form; x.is_a?(::Io::Flow::V0::Models::InvitationForm) ? x : ::Io::Flow::V0::Models::InvitationForm.new(x))
3890
3890
  r = @client.request("/invitations").with_json(invitation_form.to_json).post
3891
3891
  ::Io::Flow::V0::Models::Invitation.new(r)
3892
3892
  end
@@ -3987,7 +3987,7 @@ module Io
3987
3987
 
3988
3988
  # Create a new membership.
3989
3989
  def post(membership_form)
3990
- HttpClient::Preconditions.assert_class('membership_form', membership_form, ::Io::Flow::V0::Models::MembershipForm)
3990
+ (x = membership_form; x.is_a?(::Io::Flow::V0::Models::MembershipForm) ? x : ::Io::Flow::V0::Models::MembershipForm.new(x))
3991
3991
  r = @client.request("/memberships").with_json(membership_form.to_json).post
3992
3992
  ::Io::Flow::V0::Models::Membership.new(r)
3993
3993
  end
@@ -4007,7 +4007,7 @@ module Io
4007
4007
  # the specified role within the organization, does nothing.
4008
4008
  def put_by_id(id, membership_put_form)
4009
4009
  HttpClient::Preconditions.assert_class('id', id, String)
4010
- HttpClient::Preconditions.assert_class('membership_put_form', membership_put_form, ::Io::Flow::V0::Models::MembershipPutForm)
4010
+ (x = membership_put_form; x.is_a?(::Io::Flow::V0::Models::MembershipPutForm) ? x : ::Io::Flow::V0::Models::MembershipPutForm.new(x))
4011
4011
  r = @client.request("/memberships/#{CGI.escape(id)}").with_json(membership_put_form.to_json).put
4012
4012
  ::Io::Flow::V0::Models::Membership.new(r)
4013
4013
  end
@@ -4047,7 +4047,7 @@ module Io
4047
4047
  # and the organization environment. Otherwise, returns 401 - this indicates
4048
4048
  # either the org does not exist or the user does not have access to the org.
4049
4049
  def post(organization_authorization_form)
4050
- HttpClient::Preconditions.assert_class('organization_authorization_form', organization_authorization_form, ::Io::Flow::V0::Models::OrganizationAuthorizationForm)
4050
+ (x = organization_authorization_form; x.is_a?(::Io::Flow::V0::Models::OrganizationAuthorizationForm) ? x : ::Io::Flow::V0::Models::OrganizationAuthorizationForm.new(x))
4051
4051
  r = @client.request("/organization-authorizations").with_json(organization_authorization_form.to_json).post
4052
4052
  ::Io::Flow::V0::Models::OrganizationAuthorization.new(r)
4053
4053
  end
@@ -4121,13 +4121,13 @@ module Io
4121
4121
  query = {
4122
4122
  :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
4123
4123
  }.delete_if { |k, v| v.nil? }
4124
- HttpClient::Preconditions.assert_class('password_reset_form', password_reset_form, ::Io::Flow::V0::Models::PasswordResetForm)
4124
+ (x = password_reset_form; x.is_a?(::Io::Flow::V0::Models::PasswordResetForm) ? x : ::Io::Flow::V0::Models::PasswordResetForm.new(x))
4125
4125
  r = @client.request("/users/passwords").with_query(query).with_json(password_reset_form.to_json).post
4126
4126
  ::Io::Flow::V0::Models::ExpandableUser.from_json(r)
4127
4127
  end
4128
4128
 
4129
4129
  def post_resets(password_reset_request_form)
4130
- HttpClient::Preconditions.assert_class('password_reset_request_form', password_reset_request_form, ::Io::Flow::V0::Models::PasswordResetRequestForm)
4130
+ (x = password_reset_request_form; x.is_a?(::Io::Flow::V0::Models::PasswordResetRequestForm) ? x : ::Io::Flow::V0::Models::PasswordResetRequestForm.new(x))
4131
4131
  r = @client.request("/users/passwords/resets").with_json(password_reset_request_form.to_json).post
4132
4132
  nil
4133
4133
  end
@@ -4155,7 +4155,7 @@ module Io
4155
4155
 
4156
4156
  # Create a scheduled export.
4157
4157
  def post(scheduled_export_form)
4158
- HttpClient::Preconditions.assert_class('scheduled_export_form', scheduled_export_form, ::Io::Flow::V0::Models::ScheduledExportForm)
4158
+ (x = scheduled_export_form; x.is_a?(::Io::Flow::V0::Models::ScheduledExportForm) ? x : ::Io::Flow::V0::Models::ScheduledExportForm.new(x))
4159
4159
  r = @client.request("/users/scheduled/exports").with_json(scheduled_export_form.to_json).post
4160
4160
  ::Io::Flow::V0::Models::ScheduledExport.new(r)
4161
4161
  end
@@ -4170,7 +4170,7 @@ module Io
4170
4170
  # Update a scheduled export.
4171
4171
  def put_by_id(id, scheduled_export_form)
4172
4172
  HttpClient::Preconditions.assert_class('id', id, String)
4173
- HttpClient::Preconditions.assert_class('scheduled_export_form', scheduled_export_form, ::Io::Flow::V0::Models::ScheduledExportForm)
4173
+ (x = scheduled_export_form; x.is_a?(::Io::Flow::V0::Models::ScheduledExportForm) ? x : ::Io::Flow::V0::Models::ScheduledExportForm.new(x))
4174
4174
  r = @client.request("/users/scheduled/exports/#{CGI.escape(id)}").with_json(scheduled_export_form.to_json).put
4175
4175
  ::Io::Flow::V0::Models::ScheduledExport.new(r)
4176
4176
  end
@@ -4197,7 +4197,7 @@ module Io
4197
4197
 
4198
4198
  def put_by_session(session, session_put_form)
4199
4199
  HttpClient::Preconditions.assert_class('session', session, String)
4200
- HttpClient::Preconditions.assert_class('session_put_form', session_put_form, ::Io::Flow::V0::Models::SessionPutForm)
4200
+ (x = session_put_form; x.is_a?(::Io::Flow::V0::Models::SessionPutForm) ? x : ::Io::Flow::V0::Models::SessionPutForm.new(x))
4201
4201
  r = @client.request("/sessions/#{CGI.escape(session)}").with_json(session_put_form.to_json).put
4202
4202
  ::Io::Flow::V0::Models::Session.from_json(r)
4203
4203
  end
@@ -4211,21 +4211,21 @@ module Io
4211
4211
  # Resets the session based on the provided geo parameters.
4212
4212
  def put_reset_by_session(session, session_reset_form)
4213
4213
  HttpClient::Preconditions.assert_class('session', session, String)
4214
- HttpClient::Preconditions.assert_class('session_reset_form', session_reset_form, ::Io::Flow::V0::Models::SessionResetForm)
4214
+ (x = session_reset_form; x.is_a?(::Io::Flow::V0::Models::SessionResetForm) ? x : ::Io::Flow::V0::Models::SessionResetForm.new(x))
4215
4215
  r = @client.request("/sessions/#{CGI.escape(session)}/reset").with_json(session_reset_form.to_json).put
4216
4216
  ::Io::Flow::V0::Models::Session.from_json(r)
4217
4217
  end
4218
4218
 
4219
4219
  def post_organizations_by_organization(organization, session_form)
4220
4220
  HttpClient::Preconditions.assert_class('organization', organization, String)
4221
- HttpClient::Preconditions.assert_class('session_form', session_form, ::Io::Flow::V0::Models::SessionForm)
4221
+ (x = session_form; x.is_a?(::Io::Flow::V0::Models::SessionForm) ? x : ::Io::Flow::V0::Models::SessionForm.new(x))
4222
4222
  r = @client.request("/sessions/organizations/#{CGI.escape(organization)}").with_json(session_form.to_json).post
4223
4223
  ::Io::Flow::V0::Models::OrganizationSession.new(r)
4224
4224
  end
4225
4225
 
4226
4226
  def post_shopify_by_shop(shop, session_form)
4227
4227
  HttpClient::Preconditions.assert_class('shop', shop, String)
4228
- HttpClient::Preconditions.assert_class('session_form', session_form, ::Io::Flow::V0::Models::SessionForm)
4228
+ (x = session_form; x.is_a?(::Io::Flow::V0::Models::SessionForm) ? x : ::Io::Flow::V0::Models::SessionForm.new(x))
4229
4229
  r = @client.request("/sessions/shopify/#{CGI.escape(shop)}").with_json(session_form.to_json).post
4230
4230
  ::Io::Flow::V0::Models::OrganizationSession.new(r)
4231
4231
  end
@@ -4239,7 +4239,7 @@ module Io
4239
4239
  end
4240
4240
 
4241
4241
  def post(session_authorization_form)
4242
- HttpClient::Preconditions.assert_class('session_authorization_form', session_authorization_form, ::Io::Flow::V0::Models::SessionAuthorizationForm)
4242
+ (x = session_authorization_form; x.is_a?(::Io::Flow::V0::Models::SessionAuthorizationForm) ? x : ::Io::Flow::V0::Models::SessionAuthorizationForm.new(x))
4243
4243
  r = @client.request("/authorizations/sessions").with_json(session_authorization_form.to_json).post
4244
4244
  ::Io::Flow::V0::Models::SessionAuthorization.from_json(r)
4245
4245
  end
@@ -4308,7 +4308,7 @@ module Io
4308
4308
 
4309
4309
  # Create a new token for the requesting user
4310
4310
  def post(token_form)
4311
- HttpClient::Preconditions.assert_class('token_form', token_form, ::Io::Flow::V0::Models::TokenForm)
4311
+ (x = token_form; x.is_a?(::Io::Flow::V0::Models::TokenForm) ? x : ::Io::Flow::V0::Models::TokenForm.from_json(x))
4312
4312
  r = @client.request("/tokens").with_json(token_form.to_json).post
4313
4313
  ::Io::Flow::V0::Models::Token.from_json(r)
4314
4314
  end
@@ -4338,7 +4338,7 @@ module Io
4338
4338
  # with a form body to enusre that the token itself is not logged in the
4339
4339
  # request logs.
4340
4340
  def post_authentications(token_authentication_form)
4341
- HttpClient::Preconditions.assert_class('token_authentication_form', token_authentication_form, ::Io::Flow::V0::Models::TokenAuthenticationForm)
4341
+ (x = token_authentication_form; x.is_a?(::Io::Flow::V0::Models::TokenAuthenticationForm) ? x : ::Io::Flow::V0::Models::TokenAuthenticationForm.new(x))
4342
4342
  r = @client.request("/tokens/authentications").with_json(token_authentication_form.to_json).post
4343
4343
  ::Io::Flow::V0::Models::TokenReference.from_json(r)
4344
4344
  end
@@ -4352,7 +4352,7 @@ module Io
4352
4352
  end
4353
4353
 
4354
4354
  def post(token_validation_form)
4355
- HttpClient::Preconditions.assert_class('token_validation_form', token_validation_form, ::Io::Flow::V0::Models::TokenValidationForm)
4355
+ (x = token_validation_form; x.is_a?(::Io::Flow::V0::Models::TokenValidationForm) ? x : ::Io::Flow::V0::Models::TokenValidationForm.new(x))
4356
4356
  r = @client.request("/token-validations").with_json(token_validation_form.to_json).post
4357
4357
  ::Io::Flow::V0::Models::TokenValidation.new(r)
4358
4358
  end
@@ -4400,7 +4400,7 @@ module Io
4400
4400
  # pending and will not be able to authenticate until approved by a member of
4401
4401
  # the Flow team.
4402
4402
  def post(user_form)
4403
- HttpClient::Preconditions.assert_class('user_form', user_form, ::Io::Flow::V0::Models::UserForm)
4403
+ (x = user_form; x.is_a?(::Io::Flow::V0::Models::UserForm) ? x : ::Io::Flow::V0::Models::UserForm.new(x))
4404
4404
  r = @client.request("/users").with_json(user_form.to_json).post
4405
4405
  ::Io::Flow::V0::Models::User.new(r)
4406
4406
  end
@@ -4415,7 +4415,7 @@ module Io
4415
4415
  # Update a user.
4416
4416
  def put_by_id(id, user_put_form)
4417
4417
  HttpClient::Preconditions.assert_class('id', id, String)
4418
- HttpClient::Preconditions.assert_class('user_put_form', user_put_form, ::Io::Flow::V0::Models::UserPutForm)
4418
+ (x = user_put_form; x.is_a?(::Io::Flow::V0::Models::UserPutForm) ? x : ::Io::Flow::V0::Models::UserPutForm.new(x))
4419
4419
  r = @client.request("/users/#{CGI.escape(id)}").with_json(user_put_form.to_json).put
4420
4420
  ::Io::Flow::V0::Models::User.new(r)
4421
4421
  end
@@ -4423,7 +4423,7 @@ module Io
4423
4423
  # Update the password for a user.
4424
4424
  def patch_passwords_by_id(id, password_change_form)
4425
4425
  HttpClient::Preconditions.assert_class('id', id, String)
4426
- HttpClient::Preconditions.assert_class('password_change_form', password_change_form, ::Io::Flow::V0::Models::PasswordChangeForm)
4426
+ (x = password_change_form; x.is_a?(::Io::Flow::V0::Models::PasswordChangeForm) ? x : ::Io::Flow::V0::Models::PasswordChangeForm.new(x))
4427
4427
  r = @client.request("/users/#{CGI.escape(id)}/passwords").with_json(password_change_form.to_json).patch
4428
4428
  nil
4429
4429
  end
@@ -4438,7 +4438,7 @@ module Io
4438
4438
  # Authenticates a user by email / password. Note only users that have a status
4439
4439
  # of active will be authorized.
4440
4440
  def post_authenticate(authentication_form)
4441
- HttpClient::Preconditions.assert_class('authentication_form', authentication_form, ::Io::Flow::V0::Models::AuthenticationForm)
4441
+ (x = authentication_form; x.is_a?(::Io::Flow::V0::Models::AuthenticationForm) ? x : ::Io::Flow::V0::Models::AuthenticationForm.new(x))
4442
4442
  r = @client.request("/users/authenticate").with_json(authentication_form.to_json).post
4443
4443
  ::Io::Flow::V0::Models::User.new(r)
4444
4444
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flowcommerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flow Commerce, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2017-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -45,6 +45,7 @@ extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
47
  - README.md
48
+ - lib/flow_commerce/#client.rb#
48
49
  - lib/flow_commerce/client.rb
49
50
  - lib/flow_commerce/flow_api_v0_client.rb
50
51
  - lib/flowcommerce.rb
@@ -69,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  version: '0'
70
71
  requirements: []
71
72
  rubyforge_project:
72
- rubygems_version: 2.6.8
73
+ rubygems_version: 2.6.11
73
74
  signing_key:
74
75
  specification_version: 4
75
76
  summary: Native ruby client for the Flow REST API.