flowcommerce 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bebd37721322b3f42959e3640ced298e655ec0da
4
- data.tar.gz: f0850eabc1f615e84a2e75aede53427518830f6b
3
+ metadata.gz: 4c993743e66d4e1650e8cc123d612b35fa5efdea
4
+ data.tar.gz: c692d8752ef47e468d6689b080f92130baadd317
5
5
  SHA512:
6
- metadata.gz: 897ad1cd22ba9666298b402b37daf834d9cbbedb8a686acdd37df83ef26317391b13b703583c004c4969a15a3957813ade6996a446d82b564cc84345ea1a60ff
7
- data.tar.gz: e8a5b2ed85dfd1dbc559a5c5f0f86d208a7029238386a9ddcb3d2a5bae1843976b3ac5552baafede6c60493e78433b12785177fd7d6a921f8bfc570d4e3a7f30
6
+ metadata.gz: 3e6fcfff505fa9c3b3920ba7838ada82c00973ad08af6d5eac12b965b0efe7d460d2cc1b71b68f255641805171ffa58a0547b4c19de4e01374802b3e930a9504
7
+ data.tar.gz: e44f72706ecf3feeb3ea4b3319c48a4948935222b61748fce140f98378301b4f2c2fac57afe81bcce09eed2fcaa2b954652344274bdf472e3fbd658b70d722c3
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
2
  # Service version: 0.1.77
3
- # apidoc:0.11.49 http://www.apidoc.me/flow/api/0.2.10/ruby_client
3
+ # apidoc:0.11.49 http://www.apidoc.me/flow/api/0.2.11/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -25,7 +25,7 @@ module Io
25
25
 
26
26
  BASE_URL = 'https://api.flow.io' unless defined?(Constants::BASE_URL)
27
27
  NAMESPACE = 'io.flow.v0' unless defined?(Constants::NAMESPACE)
28
- USER_AGENT = 'apidoc:0.11.49 http://www.apidoc.me/flow/api/0.2.10/ruby_client' unless defined?(Constants::USER_AGENT)
28
+ USER_AGENT = 'apidoc:0.11.49 http://www.apidoc.me/flow/api/0.2.11/ruby_client' unless defined?(Constants::USER_AGENT)
29
29
  VERSION = '0.1.77' unless defined?(Constants::VERSION)
30
30
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
31
31
 
@@ -313,6 +313,14 @@ module Io
313
313
  @organization_authorizations ||= ::Io::Flow::V0::Clients::OrganizationAuthorizations.new(self)
314
314
  end
315
315
 
316
+ def organization_tokens
317
+ @organization_tokens ||= ::Io::Flow::V0::Clients::OrganizationTokens.new(self)
318
+ end
319
+
320
+ def partner_tokens
321
+ @partner_tokens ||= ::Io::Flow::V0::Clients::PartnerTokens.new(self)
322
+ end
323
+
316
324
  def password_reset_forms
317
325
  @password_reset_forms ||= ::Io::Flow::V0::Clients::PasswordResetForms.new(self)
318
326
  end
@@ -3595,6 +3603,52 @@ module Io
3595
3603
 
3596
3604
  end
3597
3605
 
3606
+ class OrganizationTokens
3607
+
3608
+ def initialize(client)
3609
+ @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
3610
+ end
3611
+
3612
+ # Get all tokens for the specifed organization
3613
+ def get(organization, incoming={})
3614
+ HttpClient::Preconditions.assert_class('organization', organization, String)
3615
+ opts = HttpClient::Helper.symbolize_keys(incoming)
3616
+ query = {
3617
+ :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
3618
+ :mine => (x = opts.delete(:mine); x.nil? ? nil : HttpClient::Preconditions.assert_boolean('mine', x)),
3619
+ :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
3620
+ :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
3621
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
3622
+ }.delete_if { |k, v| v.nil? }
3623
+ r = @client.request("/#{CGI.escape(organization)}/tokens").with_query(query).get
3624
+ r.map { |x| ::Io::Flow::V0::Models::OrganizationToken.new(x) }
3625
+ end
3626
+
3627
+ end
3628
+
3629
+ class PartnerTokens
3630
+
3631
+ def initialize(client)
3632
+ @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
3633
+ end
3634
+
3635
+ # Get all tokens for the specifed partner
3636
+ def get(partner, incoming={})
3637
+ HttpClient::Preconditions.assert_class('partner', partner, String)
3638
+ opts = HttpClient::Helper.symbolize_keys(incoming)
3639
+ query = {
3640
+ :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
3641
+ :mine => (x = opts.delete(:mine); x.nil? ? nil : HttpClient::Preconditions.assert_boolean('mine', x)),
3642
+ :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
3643
+ :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
3644
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
3645
+ }.delete_if { |k, v| v.nil? }
3646
+ r = @client.request("/partners/#{CGI.escape(partner)}/tokens").with_query(query).get
3647
+ r.map { |x| ::Io::Flow::V0::Models::PartnerToken.new(x) }
3648
+ end
3649
+
3650
+ end
3651
+
3598
3652
  class PasswordResetForms
3599
3653
 
3600
3654
  def initialize(client)
@@ -3670,6 +3724,7 @@ module Io
3670
3724
  :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
3671
3725
  :organization => (x = opts.delete(:organization); x.nil? ? nil : HttpClient::Preconditions.assert_class('organization', x, String)),
3672
3726
  :partner => (x = opts.delete(:partner); x.nil? ? nil : HttpClient::Preconditions.assert_class('partner', x, String)),
3727
+ :mine => (x = opts.delete(:mine); x.nil? ? nil : HttpClient::Preconditions.assert_boolean('mine', x)),
3673
3728
  :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
3674
3729
  :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
3675
3730
  :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
@@ -3903,6 +3958,7 @@ module Io
3903
3958
 
3904
3959
  module Types
3905
3960
  DEMINIMIS_SIMPLE = 'deminimis_simple' unless defined?(DEMINIMIS_SIMPLE)
3961
+ DEMINIMIS_PER_ITEM = 'deminimis_per_item' unless defined?(DEMINIMIS_PER_ITEM)
3906
3962
  end
3907
3963
 
3908
3964
  def initialize(incoming={})
@@ -3912,7 +3968,7 @@ module Io
3912
3968
  end
3913
3969
 
3914
3970
  def subtype_to_hash
3915
- raise 'Cannot serialize an instance of deminimis directly - must use one of the specific types: deminimis_simple'
3971
+ raise 'Cannot serialize an instance of deminimis directly - must use one of the specific types: deminimis_simple, deminimis_per_item'
3916
3972
  end
3917
3973
 
3918
3974
  def to_hash
@@ -3927,6 +3983,7 @@ module Io
3927
3983
  end
3928
3984
  case discriminator
3929
3985
  when Types::DEMINIMIS_SIMPLE; DeminimisSimple.new(hash)
3986
+ when Types::DEMINIMIS_PER_ITEM; DeminimisPerItem.new(hash)
3930
3987
  else DeminimisUndefinedType.new(:name => discriminator)
3931
3988
  end
3932
3989
  end
@@ -4670,66 +4727,6 @@ module Io
4670
4727
 
4671
4728
  end
4672
4729
 
4673
- class OrderError
4674
-
4675
- module Types
4676
- ORDER_ITEM_NOT_AVAILABLE_ERROR = 'order_item_not_available_error' unless defined?(ORDER_ITEM_NOT_AVAILABLE_ERROR)
4677
- GENERIC_ERROR = 'generic_error' unless defined?(GENERIC_ERROR)
4678
- end
4679
-
4680
- def initialize(incoming={})
4681
- opts = HttpClient::Helper.symbolize_keys(incoming)
4682
- HttpClient::Preconditions.require_keys(opts, [:name], 'OrderError')
4683
- @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
4684
- end
4685
-
4686
- def subtype_to_hash
4687
- raise 'Cannot serialize an instance of order_error directly - must use one of the specific types: order_item_not_available_error, generic_error'
4688
- end
4689
-
4690
- def to_hash
4691
- subtype_to_hash.merge(:code => @name)
4692
- end
4693
-
4694
- def OrderError.from_json(hash)
4695
- HttpClient::Preconditions.assert_class('hash', hash, Hash)
4696
- discriminator = HttpClient::Helper.symbolize_keys(hash)[:code].to_s.strip
4697
- if discriminator.empty?
4698
- raise "Union type[order_error] requires a field named 'code'"
4699
- end
4700
- case discriminator
4701
- when Types::ORDER_ITEM_NOT_AVAILABLE_ERROR; OrderItemNotAvailableError.new(hash)
4702
- when Types::GENERIC_ERROR; GenericError.new(hash)
4703
- else OrderErrorUndefinedType.new(:name => discriminator)
4704
- end
4705
- end
4706
-
4707
- end
4708
-
4709
- class OrderErrorUndefinedType < OrderError
4710
-
4711
- attr_reader :name
4712
-
4713
- def initialize(incoming={})
4714
- super(:name => 'undefined_type')
4715
- opts = HttpClient::Helper.symbolize_keys(incoming)
4716
- @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
4717
- end
4718
-
4719
- def subtype_to_hash
4720
- raise 'Unable to serialize undefined type to json'
4721
- end
4722
-
4723
- def copy(incoming={})
4724
- raise 'Operation not supported for undefined type'
4725
- end
4726
-
4727
- def to_hash
4728
- raise 'Operation not supported for undefined type'
4729
- end
4730
-
4731
- end
4732
-
4733
4730
  # Possible outcome types from a tier rule
4734
4731
  class TierRuleOutcome
4735
4732
 
@@ -5048,7 +5045,7 @@ module Io
5048
5045
  end
5049
5046
 
5050
5047
  def AuthorizationDeclineCode.ALL
5051
- @@all ||= [AuthorizationDeclineCode.expired, AuthorizationDeclineCode.invalid_number, AuthorizationDeclineCode.invalid_expiration, AuthorizationDeclineCode.no_account, AuthorizationDeclineCode.avs, AuthorizationDeclineCode.cvv, AuthorizationDeclineCode.fraud, AuthorizationDeclineCode.duplicate, AuthorizationDeclineCode.not_supported, AuthorizationDeclineCode.unknown]
5048
+ @@all ||= [AuthorizationDeclineCode.expired, AuthorizationDeclineCode.invalid_name, AuthorizationDeclineCode.invalid_number, AuthorizationDeclineCode.invalid_expiration, AuthorizationDeclineCode.no_account, AuthorizationDeclineCode.avs, AuthorizationDeclineCode.cvv, AuthorizationDeclineCode.fraud, AuthorizationDeclineCode.duplicate, AuthorizationDeclineCode.not_supported, AuthorizationDeclineCode.unknown]
5052
5049
  end
5053
5050
 
5054
5051
  # Payment method has expired
@@ -5056,6 +5053,11 @@ module Io
5056
5053
  @@_expired ||= AuthorizationDeclineCode.new('expired')
5057
5054
  end
5058
5055
 
5056
+ # Invalid card holder name
5057
+ def AuthorizationDeclineCode.invalid_name
5058
+ @@_invalid_name ||= AuthorizationDeclineCode.new('invalid_name')
5059
+ end
5060
+
5059
5061
  # Invalid payment number
5060
5062
  def AuthorizationDeclineCode.invalid_number
5061
5063
  @@_invalid_number ||= AuthorizationDeclineCode.new('invalid_number')
@@ -5358,6 +5360,80 @@ module Io
5358
5360
 
5359
5361
  end
5360
5362
 
5363
+ class CardErrorCode
5364
+
5365
+ attr_reader :value
5366
+
5367
+ def initialize(value)
5368
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
5369
+ end
5370
+
5371
+ # Returns the instance of CardErrorCode for this value, creating a new instance for an unknown value
5372
+ def CardErrorCode.apply(value)
5373
+ if value.instance_of?(CardErrorCode)
5374
+ value
5375
+ else
5376
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
5377
+ value.nil? ? nil : (from_string(value) || CardErrorCode.new(value))
5378
+ end
5379
+ end
5380
+
5381
+ # Returns the instance of CardErrorCode for this value, or nil if not found
5382
+ def CardErrorCode.from_string(value)
5383
+ HttpClient::Preconditions.assert_class('value', value, String)
5384
+ CardErrorCode.ALL.find { |v| v.value == value }
5385
+ end
5386
+
5387
+ def CardErrorCode.ALL
5388
+ @@all ||= [CardErrorCode.invalid_address, CardErrorCode.invalid_name, CardErrorCode.invalid_number, CardErrorCode.invalid_expiration, CardErrorCode.avs, CardErrorCode.cvv, CardErrorCode.fraud, CardErrorCode.unknown]
5389
+ end
5390
+
5391
+ # Invalid billing address
5392
+ def CardErrorCode.invalid_address
5393
+ @@_invalid_address ||= CardErrorCode.new('invalid_address')
5394
+ end
5395
+
5396
+ # Invalid cardholder name
5397
+ def CardErrorCode.invalid_name
5398
+ @@_invalid_name ||= CardErrorCode.new('invalid_name')
5399
+ end
5400
+
5401
+ # Invalid payment number
5402
+ def CardErrorCode.invalid_number
5403
+ @@_invalid_number ||= CardErrorCode.new('invalid_number')
5404
+ end
5405
+
5406
+ # Invalid expiration date
5407
+ def CardErrorCode.invalid_expiration
5408
+ @@_invalid_expiration ||= CardErrorCode.new('invalid_expiration')
5409
+ end
5410
+
5411
+ # Declined due to avs mismatch
5412
+ def CardErrorCode.avs
5413
+ @@_avs ||= CardErrorCode.new('avs')
5414
+ end
5415
+
5416
+ # Declined due to cvv mismatch
5417
+ def CardErrorCode.cvv
5418
+ @@_cvv ||= CardErrorCode.new('cvv')
5419
+ end
5420
+
5421
+ # Declined due to suspected fraud
5422
+ def CardErrorCode.fraud
5423
+ @@_fraud ||= CardErrorCode.new('fraud')
5424
+ end
5425
+
5426
+ # Declined due to another reason (details not known)
5427
+ def CardErrorCode.unknown
5428
+ @@_unknown ||= CardErrorCode.new('unknown')
5429
+ end
5430
+
5431
+ def to_hash
5432
+ value
5433
+ end
5434
+
5435
+ end
5436
+
5361
5437
  class CardType
5362
5438
 
5363
5439
  attr_reader :value
@@ -5939,6 +6015,57 @@ module Io
5939
6015
 
5940
6016
  end
5941
6017
 
6018
+ class GenericErrorCode
6019
+
6020
+ attr_reader :value
6021
+
6022
+ def initialize(value)
6023
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
6024
+ end
6025
+
6026
+ # Returns the instance of GenericErrorCode for this value, creating a new instance for an unknown value
6027
+ def GenericErrorCode.apply(value)
6028
+ if value.instance_of?(GenericErrorCode)
6029
+ value
6030
+ else
6031
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
6032
+ value.nil? ? nil : (from_string(value) || GenericErrorCode.new(value))
6033
+ end
6034
+ end
6035
+
6036
+ # Returns the instance of GenericErrorCode for this value, or nil if not found
6037
+ def GenericErrorCode.from_string(value)
6038
+ HttpClient::Preconditions.assert_class('value', value, String)
6039
+ GenericErrorCode.ALL.find { |v| v.value == value }
6040
+ end
6041
+
6042
+ def GenericErrorCode.ALL
6043
+ @@all ||= [GenericErrorCode.generic_error, GenericErrorCode.client_error, GenericErrorCode.server_error]
6044
+ end
6045
+
6046
+ # Generic errors are the default type. The accompanying message will provide
6047
+ # details on the failure.
6048
+ def GenericErrorCode.generic_error
6049
+ @@_generic_error ||= GenericErrorCode.new('generic_error')
6050
+ end
6051
+
6052
+ # A client error has occurred. This represents a misconfiguration of the client
6053
+ def GenericErrorCode.client_error
6054
+ @@_client_error ||= GenericErrorCode.new('client_error')
6055
+ end
6056
+
6057
+ # A server error has occurred. The Flow tech team is automatically notified of
6058
+ # all server errors
6059
+ def GenericErrorCode.server_error
6060
+ @@_server_error ||= GenericErrorCode.new('server_error')
6061
+ end
6062
+
6063
+ def to_hash
6064
+ value
6065
+ end
6066
+
6067
+ end
6068
+
5942
6069
  class HolidayCalendar
5943
6070
 
5944
6071
  attr_reader :value
@@ -6293,6 +6420,52 @@ module Io
6293
6420
 
6294
6421
  end
6295
6422
 
6423
+ class OrderErrorCode
6424
+
6425
+ attr_reader :value
6426
+
6427
+ def initialize(value)
6428
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
6429
+ end
6430
+
6431
+ # Returns the instance of OrderErrorCode for this value, creating a new instance for an unknown value
6432
+ def OrderErrorCode.apply(value)
6433
+ if value.instance_of?(OrderErrorCode)
6434
+ value
6435
+ else
6436
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
6437
+ value.nil? ? nil : (from_string(value) || OrderErrorCode.new(value))
6438
+ end
6439
+ end
6440
+
6441
+ # Returns the instance of OrderErrorCode for this value, or nil if not found
6442
+ def OrderErrorCode.from_string(value)
6443
+ HttpClient::Preconditions.assert_class('value', value, String)
6444
+ OrderErrorCode.ALL.find { |v| v.value == value }
6445
+ end
6446
+
6447
+ def OrderErrorCode.ALL
6448
+ @@all ||= [OrderErrorCode.generic_error, OrderErrorCode.order_item_not_available]
6449
+ end
6450
+
6451
+ def OrderErrorCode.generic_error
6452
+ @@_generic_error ||= OrderErrorCode.new('generic_error')
6453
+ end
6454
+
6455
+ # When creating an order, if a particular item is not available in the country /
6456
+ # destination (either because it was restricted or excluded from that country),
6457
+ # we return this error code and list the specific item numbers which are not
6458
+ # available in the 'numbers' field.
6459
+ def OrderErrorCode.order_item_not_available
6460
+ @@_order_item_not_available ||= OrderErrorCode.new('order_item_not_available')
6461
+ end
6462
+
6463
+ def to_hash
6464
+ value
6465
+ end
6466
+
6467
+ end
6468
+
6296
6469
  class OrderPriceDetailComponentKey
6297
6470
 
6298
6471
  attr_reader :value
@@ -8017,7 +8190,7 @@ module Io
8017
8190
  # capture up to the amount of the authorization.
8018
8191
  class Authorization
8019
8192
 
8020
- attr_reader :id, :key, :card, :amount, :currency, :customer, :attributes, :destination, :ip, :cvv, :result, :created_at
8193
+ attr_reader :id, :key, :card, :amount, :currency, :customer, :attributes, :destination, :ip, :result, :created_at
8021
8194
 
8022
8195
  def initialize(incoming={})
8023
8196
  opts = HttpClient::Helper.symbolize_keys(incoming)
@@ -8031,7 +8204,6 @@ module Io
8031
8204
  @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }
8032
8205
  @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)))
8033
8206
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
8034
- @cvv = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, String))
8035
8207
  @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::AuthorizationResult) ? x : ::Io::Flow::V0::Models::AuthorizationResult.new(x))
8036
8208
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
8037
8209
  end
@@ -8055,7 +8227,6 @@ module Io
8055
8227
  :attributes => attributes,
8056
8228
  :destination => destination.nil? ? nil : destination.to_hash,
8057
8229
  :ip => ip,
8058
- :cvv => cvv,
8059
8230
  :result => result.to_hash,
8060
8231
  :created_at => created_at
8061
8232
  }
@@ -8534,6 +8705,39 @@ module Io
8534
8705
 
8535
8706
  end
8536
8707
 
8708
+ # Details for why a card was declined
8709
+ class CardError
8710
+
8711
+ attr_reader :code, :messages, :avs, :cvv
8712
+
8713
+ def initialize(incoming={})
8714
+ opts = HttpClient::Helper.symbolize_keys(incoming)
8715
+ HttpClient::Preconditions.require_keys(opts, [:code, :messages], 'CardError')
8716
+ @code = (x = opts.delete(:code); x.is_a?(::Io::Flow::V0::Models::CardErrorCode) ? x : ::Io::Flow::V0::Models::CardErrorCode.apply(x))
8717
+ @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
8718
+ @avs = (x = opts.delete(:avs); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Avs) ? x : ::Io::Flow::V0::Models::Avs.new(x)))
8719
+ @cvv = (x = opts.delete(:cvv); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Cvv) ? x : ::Io::Flow::V0::Models::Cvv.new(x)))
8720
+ end
8721
+
8722
+ def to_json
8723
+ JSON.dump(to_hash)
8724
+ end
8725
+
8726
+ def copy(incoming={})
8727
+ CardError.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
8728
+ end
8729
+
8730
+ def to_hash
8731
+ {
8732
+ :code => code.value,
8733
+ :messages => messages,
8734
+ :avs => avs.nil? ? nil : avs.to_hash,
8735
+ :cvv => cvv.nil? ? nil : cvv.to_hash
8736
+ }
8737
+ end
8738
+
8739
+ end
8740
+
8537
8741
  class CardForm
8538
8742
 
8539
8743
  attr_reader :number, :cipher, :expiration_month, :expiration_year, :name, :cvv, :address, :ip, :challenge_text, :challenge_cipher
@@ -10008,6 +10212,41 @@ module Io
10008
10212
 
10009
10213
  end
10010
10214
 
10215
+ # De Minimis per item describes rules which require minimum and/or maximum
10216
+ # values per item
10217
+ class DeminimisPerItem < Deminimis
10218
+
10219
+ attr_reader :currency, :minimum, :maximum
10220
+
10221
+ def initialize(incoming={})
10222
+ super(:name => Deminimis::Types::DEMINIMIS_PER_ITEM)
10223
+ opts = HttpClient::Helper.symbolize_keys(incoming)
10224
+ HttpClient::Preconditions.require_keys(opts, [:currency], 'DeminimisPerItem')
10225
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
10226
+ @minimum = (x = opts.delete(:minimum); x.nil? ? nil : HttpClient::Preconditions.assert_class('minimum', HttpClient::Helper.to_big_decimal(x), BigDecimal))
10227
+ @maximum = (x = opts.delete(:maximum); x.nil? ? nil : HttpClient::Preconditions.assert_class('maximum', HttpClient::Helper.to_big_decimal(x), BigDecimal))
10228
+ end
10229
+
10230
+ def to_json
10231
+ JSON.dump(to_hash)
10232
+ end
10233
+
10234
+ def copy(incoming={})
10235
+ DeminimisPerItem.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
10236
+ end
10237
+
10238
+ def subtype_to_hash
10239
+ {
10240
+ :currency => currency,
10241
+ :minimum => minimum,
10242
+ :maximum => maximum
10243
+ }
10244
+ end
10245
+
10246
+ end
10247
+
10248
+ # De Minimis for most common example which includes a value threshold and rules
10249
+ # on what components are used in the duty calculation
10011
10250
  class DeminimisSimple < Deminimis
10012
10251
 
10013
10252
  attr_reader :value, :currency, :components, :minimum
@@ -10924,14 +11163,14 @@ module Io
10924
11163
 
10925
11164
  # An error of some type has occured. The most common error will be validation on
10926
11165
  # input. See messages for details.
10927
- class GenericError < OrderError
11166
+ class GenericError
10928
11167
 
10929
- attr_reader :messages
11168
+ attr_reader :code, :messages
10930
11169
 
10931
11170
  def initialize(incoming={})
10932
- super(:name => OrderError::Types::GENERIC_ERROR)
10933
11171
  opts = HttpClient::Helper.symbolize_keys(incoming)
10934
11172
  HttpClient::Preconditions.require_keys(opts, [:messages], 'GenericError')
11173
+ @code = (x = (x = opts.delete(:code); x.nil? ? "generic_error" : x); x.is_a?(::Io::Flow::V0::Models::GenericErrorCode) ? x : ::Io::Flow::V0::Models::GenericErrorCode.apply(x))
10935
11174
  @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
10936
11175
  end
10937
11176
 
@@ -10940,11 +11179,12 @@ module Io
10940
11179
  end
10941
11180
 
10942
11181
  def copy(incoming={})
10943
- GenericError.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
11182
+ GenericError.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
10944
11183
  end
10945
11184
 
10946
- def subtype_to_hash
11185
+ def to_hash
10947
11186
  {
11187
+ :code => code.value,
10948
11188
  :messages => messages
10949
11189
  }
10950
11190
  end
@@ -14308,6 +14548,36 @@ module Io
14308
14548
 
14309
14549
  end
14310
14550
 
14551
+ class OrderError
14552
+
14553
+ attr_reader :code, :messages, :numbers
14554
+
14555
+ def initialize(incoming={})
14556
+ opts = HttpClient::Helper.symbolize_keys(incoming)
14557
+ HttpClient::Preconditions.require_keys(opts, [:code, :messages], 'OrderError')
14558
+ @code = (x = opts.delete(:code); x.is_a?(::Io::Flow::V0::Models::OrderErrorCode) ? x : ::Io::Flow::V0::Models::OrderErrorCode.apply(x))
14559
+ @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
14560
+ @numbers = (x = opts.delete(:numbers); x.nil? ? nil : HttpClient::Preconditions.assert_class('numbers', x, Array).map { |v| HttpClient::Preconditions.assert_class('numbers', v, String) })
14561
+ end
14562
+
14563
+ def to_json
14564
+ JSON.dump(to_hash)
14565
+ end
14566
+
14567
+ def copy(incoming={})
14568
+ OrderError.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
14569
+ end
14570
+
14571
+ def to_hash
14572
+ {
14573
+ :code => code.value,
14574
+ :messages => messages,
14575
+ :numbers => numbers.nil? ? nil : numbers
14576
+ }
14577
+ end
14578
+
14579
+ end
14580
+
14311
14581
  # Lightweight estimate for a group of items without any customer-related
14312
14582
  # information. This will contain available estimates on shipping, taxes, and
14313
14583
  # duties.
@@ -14412,39 +14682,6 @@ module Io
14412
14682
 
14413
14683
  end
14414
14684
 
14415
- # When creating an order, if a particular item is not available in the country /
14416
- # destination (either because it was restricted or excluded from that country),
14417
- # we return this error to highlight the specific item numbers which are not
14418
- # available.
14419
- class OrderItemNotAvailableError < OrderError
14420
-
14421
- attr_reader :messages, :numbers
14422
-
14423
- def initialize(incoming={})
14424
- super(:name => OrderError::Types::ORDER_ITEM_NOT_AVAILABLE_ERROR)
14425
- opts = HttpClient::Helper.symbolize_keys(incoming)
14426
- HttpClient::Preconditions.require_keys(opts, [:messages, :numbers], 'OrderItemNotAvailableError')
14427
- @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
14428
- @numbers = HttpClient::Preconditions.assert_class('numbers', opts.delete(:numbers), Array).map { |v| HttpClient::Preconditions.assert_class('numbers', v, String) }
14429
- end
14430
-
14431
- def to_json
14432
- JSON.dump(to_hash)
14433
- end
14434
-
14435
- def copy(incoming={})
14436
- OrderItemNotAvailableError.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
14437
- end
14438
-
14439
- def subtype_to_hash
14440
- {
14441
- :messages => messages,
14442
- :numbers => numbers
14443
- }
14444
- end
14445
-
14446
- end
14447
-
14448
14685
  # Represents a top-level order price detail, e.g. 'Subtotal' or 'VAT'.
14449
14686
  class OrderPriceDetail
14450
14687
 
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.1.2
4
+ version: 0.1.3
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: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json