flowcommerce 0.2.2 → 0.2.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: cb09e284a9abf6304be123c3ab7c499ab5c1e760
4
- data.tar.gz: 98daddee35444116ec7db554025e2a5b13d5b7e9
3
+ metadata.gz: 1b5ad9356b106494c6d3da933e5d44ae196bc1b9
4
+ data.tar.gz: 01f48ca191ebf8cb56994973e3a604cef1c74a85
5
5
  SHA512:
6
- metadata.gz: b710ea50341b2fd529ec1b3e183f51a888c2a2878fa5fec97ff89063a94bfac80061f8775de236003338415f81237e853c275d50e385acb7cc28807c4bdacc16
7
- data.tar.gz: aef43b36b05640cf204b5562c0950c93a2791a3a39946ff9165a12549badc7f8ba1acbacf560f5eea12c2c51999ae6e50254e243227cf3ccfedd72983c74485e
6
+ metadata.gz: bb9c0baa7a372ddce6ac2837ab15bd90b2eae5dd1c93d9ab8697ecd4d390e1466877c3514e9cb54c9ed221498c3e34b26bb3dc9e33594ca76016ccd3101b290d
7
+ data.tar.gz: 97e3d8efe8050a30314d6109ed4f8435b48770cd89a404f1dc8d3d558acf97a2f6ee8a916531a1c13f6c88c912d0b7de68d0b9a5ddc41dd402ba0ef90c1c3c49
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
2
  # Service version: 0.2.87
3
- # apidoc:0.11.75 http://www.apidoc.me/flow/api/0.2.87/ruby_client
3
+ # apidoc:0.11.76 http://www.apidoc.me/flow/api/0.2.89/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.75 http://www.apidoc.me/flow/api/0.2.87/ruby_client' unless defined?(Constants::USER_AGENT)
28
+ USER_AGENT = 'apidoc:0.11.76 http://www.apidoc.me/flow/api/0.2.89/ruby_client' unless defined?(Constants::USER_AGENT)
29
29
  VERSION = '0.2.87' unless defined?(Constants::VERSION)
30
30
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
31
31
 
@@ -842,7 +842,8 @@ module Io
842
842
  :number => (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, Array).map { |v| HttpClient::Preconditions.assert_class('number', v, String) }),
843
843
  :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
844
844
  :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
845
- :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
845
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String),
846
+ :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
846
847
  }.delete_if { |k, v| v.nil? }
847
848
  r = @client.request("/#{CGI.escape(organization)}/orders").with_query(query).get
848
849
  r.map { |x| ::Io::Flow::V0::Models::Order.new(x) }
@@ -867,10 +868,14 @@ module Io
867
868
  end
868
869
 
869
870
  # Returns information about a specific order.
870
- def get_by_number(organization, number)
871
+ def get_by_number(organization, number, incoming={})
871
872
  HttpClient::Preconditions.assert_class('organization', organization, String)
872
873
  HttpClient::Preconditions.assert_class('number', number, String)
873
- r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}").get
874
+ opts = HttpClient::Helper.symbolize_keys(incoming)
875
+ query = {
876
+ :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
877
+ }.delete_if { |k, v| v.nil? }
878
+ r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}").with_query(query).get
874
879
  ::Io::Flow::V0::Models::Order.new(r)
875
880
  end
876
881
 
@@ -2071,7 +2076,7 @@ module Io
2071
2076
  :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
2072
2077
  }.delete_if { |k, v| v.nil? }
2073
2078
  r = @client.request("/#{CGI.escape(organization)}/authorizations").with_query(query).get
2074
- r.map { |x| ::Io::Flow::V0::Models::Authorization.new(x) }
2079
+ r.map { |x| ::Io::Flow::V0::Models::Authorization.from_json(x) }
2075
2080
  end
2076
2081
 
2077
2082
  # Create a new authorization.
@@ -2079,7 +2084,7 @@ module Io
2079
2084
  HttpClient::Preconditions.assert_class('organization', organization, String)
2080
2085
  HttpClient::Preconditions.assert_class('authorization_form', authorization_form, ::Io::Flow::V0::Models::AuthorizationForm)
2081
2086
  r = @client.request("/#{CGI.escape(organization)}/authorizations").with_json(authorization_form.to_json).post
2082
- ::Io::Flow::V0::Models::Authorization.new(r)
2087
+ ::Io::Flow::V0::Models::Authorization.from_json(r)
2083
2088
  end
2084
2089
 
2085
2090
  # Returns information about a specific authorization.
@@ -2091,7 +2096,7 @@ module Io
2091
2096
  :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
2092
2097
  }.delete_if { |k, v| v.nil? }
2093
2098
  r = @client.request("/#{CGI.escape(organization)}/authorizations/#{CGI.escape(key)}").with_query(query).get
2094
- ::Io::Flow::V0::Models::Authorization.new(r)
2099
+ ::Io::Flow::V0::Models::Authorization.from_json(r)
2095
2100
  end
2096
2101
 
2097
2102
  # Deletes a given authorization. This method will return a 422 if funds have
@@ -4193,6 +4198,68 @@ module Io
4193
4198
 
4194
4199
  module Models
4195
4200
 
4201
+ class Authorization
4202
+
4203
+ module Types
4204
+ CARD_AUTHORIZATION = 'card_authorization' unless defined?(CARD_AUTHORIZATION)
4205
+ ONLINE_AUTHORIZATION = 'online_authorization' unless defined?(ONLINE_AUTHORIZATION)
4206
+ end
4207
+
4208
+ attr_reader :discriminator
4209
+
4210
+ def initialize(incoming={})
4211
+ opts = HttpClient::Helper.symbolize_keys(incoming)
4212
+ HttpClient::Preconditions.require_keys(opts, [:discriminator], 'Authorization')
4213
+ @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
4214
+ end
4215
+
4216
+ def subtype_to_hash
4217
+ raise 'Cannot serialize an instance of authorization directly - must use one of the specific types: card_authorization, online_authorization'
4218
+ end
4219
+
4220
+ def to_hash
4221
+ subtype_to_hash.merge(:discriminator => @discriminator)
4222
+ end
4223
+
4224
+ def Authorization.from_json(hash)
4225
+ HttpClient::Preconditions.assert_class('hash', hash, Hash)
4226
+ discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
4227
+ if discriminator.empty?
4228
+ raise "Union type[authorization] requires a field named 'discriminator'"
4229
+ end
4230
+ case discriminator
4231
+ when Types::CARD_AUTHORIZATION; CardAuthorization.new(hash)
4232
+ when Types::ONLINE_AUTHORIZATION; OnlineAuthorization.new(hash)
4233
+ else AuthorizationUndefinedType.new(:discriminator => discriminator)
4234
+ end
4235
+ end
4236
+
4237
+ end
4238
+
4239
+ class AuthorizationUndefinedType < Authorization
4240
+
4241
+ attr_reader :name
4242
+
4243
+ def initialize(incoming={})
4244
+ super(:discriminator => 'undefined_type')
4245
+ opts = HttpClient::Helper.symbolize_keys(incoming)
4246
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:discriminator), String)
4247
+ end
4248
+
4249
+ def subtype_to_hash
4250
+ raise 'Unable to serialize undefined type to json'
4251
+ end
4252
+
4253
+ def copy(incoming={})
4254
+ raise 'Operation not supported for undefined type'
4255
+ end
4256
+
4257
+ def to_hash
4258
+ raise 'Operation not supported for undefined type'
4259
+ end
4260
+
4261
+ end
4262
+
4196
4263
  # Flow provides several different options for creating an authorization
4197
4264
  class AuthorizationForm
4198
4265
 
@@ -4201,6 +4268,10 @@ module Io
4201
4268
  DIRECT_AUTHORIZATION_FORM = 'direct_authorization_form' unless defined?(DIRECT_AUTHORIZATION_FORM)
4202
4269
  # Enables card payments with Flow as Merchant of Record
4203
4270
  MERCHANT_OF_RECORD_AUTHORIZATION_FORM = 'merchant_of_record_authorization_form' unless defined?(MERCHANT_OF_RECORD_AUTHORIZATION_FORM)
4271
+ # Enables online alternative payment methods
4272
+ DIRECT_ONLINE_PAYMENT_FORM = 'direct_online_payment_form' unless defined?(DIRECT_ONLINE_PAYMENT_FORM)
4273
+ # Enables online alternative payment methods with Flow as Merchant of Record
4274
+ MERCHANT_OF_RECORD_ONLINE_PAYMENT_FORM = 'merchant_of_record_online_payment_form' unless defined?(MERCHANT_OF_RECORD_ONLINE_PAYMENT_FORM)
4204
4275
  end
4205
4276
 
4206
4277
  attr_reader :discriminator
@@ -4212,7 +4283,7 @@ module Io
4212
4283
  end
4213
4284
 
4214
4285
  def subtype_to_hash
4215
- raise 'Cannot serialize an instance of authorization_form directly - must use one of the specific types: direct_authorization_form, merchant_of_record_authorization_form'
4286
+ raise 'Cannot serialize an instance of authorization_form directly - must use one of the specific types: direct_authorization_form, merchant_of_record_authorization_form, direct_online_payment_form, merchant_of_record_online_payment_form'
4216
4287
  end
4217
4288
 
4218
4289
  def to_hash
@@ -4228,6 +4299,8 @@ module Io
4228
4299
  case discriminator
4229
4300
  when Types::DIRECT_AUTHORIZATION_FORM; DirectAuthorizationForm.new(hash)
4230
4301
  when Types::MERCHANT_OF_RECORD_AUTHORIZATION_FORM; MerchantOfRecordAuthorizationForm.new(hash)
4302
+ when Types::DIRECT_ONLINE_PAYMENT_FORM; DirectOnlinePaymentForm.new(hash)
4303
+ when Types::MERCHANT_OF_RECORD_ONLINE_PAYMENT_FORM; MerchantOfRecordOnlinePaymentForm.new(hash)
4231
4304
  else AuthorizationFormUndefinedType.new(:discriminator => discriminator)
4232
4305
  end
4233
4306
  end
@@ -4683,6 +4756,68 @@ module Io
4683
4756
 
4684
4757
  end
4685
4758
 
4759
+ class ExpandableExperience
4760
+
4761
+ module Types
4762
+ EXPERIENCE = 'experience' unless defined?(EXPERIENCE)
4763
+ EXPERIENCE_REFERENCE = 'experience_reference' unless defined?(EXPERIENCE_REFERENCE)
4764
+ end
4765
+
4766
+ attr_reader :discriminator
4767
+
4768
+ def initialize(incoming={})
4769
+ opts = HttpClient::Helper.symbolize_keys(incoming)
4770
+ HttpClient::Preconditions.require_keys(opts, [:discriminator], 'ExpandableExperience')
4771
+ @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
4772
+ end
4773
+
4774
+ def subtype_to_hash
4775
+ raise 'Cannot serialize an instance of expandable_experience directly - must use one of the specific types: experience, experience_reference'
4776
+ end
4777
+
4778
+ def to_hash
4779
+ subtype_to_hash.merge(:discriminator => @discriminator)
4780
+ end
4781
+
4782
+ def ExpandableExperience.from_json(hash)
4783
+ HttpClient::Preconditions.assert_class('hash', hash, Hash)
4784
+ discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
4785
+ if discriminator.empty?
4786
+ raise "Union type[expandable_experience] requires a field named 'discriminator'"
4787
+ end
4788
+ case discriminator
4789
+ when Types::EXPERIENCE; Experience.new(hash)
4790
+ when Types::EXPERIENCE_REFERENCE; ExperienceReference.new(hash)
4791
+ else ExpandableExperienceUndefinedType.new(:discriminator => discriminator)
4792
+ end
4793
+ end
4794
+
4795
+ end
4796
+
4797
+ class ExpandableExperienceUndefinedType < ExpandableExperience
4798
+
4799
+ attr_reader :name
4800
+
4801
+ def initialize(incoming={})
4802
+ super(:discriminator => 'undefined_type')
4803
+ opts = HttpClient::Helper.symbolize_keys(incoming)
4804
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:discriminator), String)
4805
+ end
4806
+
4807
+ def subtype_to_hash
4808
+ raise 'Unable to serialize undefined type to json'
4809
+ end
4810
+
4811
+ def copy(incoming={})
4812
+ raise 'Operation not supported for undefined type'
4813
+ end
4814
+
4815
+ def to_hash
4816
+ raise 'Operation not supported for undefined type'
4817
+ end
4818
+
4819
+ end
4820
+
4686
4821
  # An item function can be represented with just its Id, or the entire model
4687
4822
  class ExpandableItemFunction
4688
4823
 
@@ -9951,57 +10086,6 @@ module Io
9951
10086
 
9952
10087
  end
9953
10088
 
9954
- # An authorization is used to check and reserve funds w/ a given payment method.
9955
- # No funds are actually transferred; once you have you an authorization, you can
9956
- # capture up to the amount of the authorization.
9957
- class Authorization
9958
-
9959
- attr_reader :id, :key, :card, :amount, :currency, :customer, :attributes, :destination, :order, :ip, :result, :created_at
9960
-
9961
- def initialize(incoming={})
9962
- opts = HttpClient::Helper.symbolize_keys(incoming)
9963
- HttpClient::Preconditions.require_keys(opts, [:id, :key, :amount, :currency, :customer, :attributes, :result, :created_at], 'Authorization')
9964
- @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
9965
- @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
9966
- @card = (x = opts.delete(:card); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExpandableCard) ? x : ::Io::Flow::V0::Models::ExpandableCard.from_json(x)))
9967
- @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
9968
- @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
9969
- @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
9970
- @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 }
9971
- @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)))
9972
- @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationOrderReference) ? x : ::Io::Flow::V0::Models::AuthorizationOrderReference.new(x)))
9973
- @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
9974
- @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::AuthorizationResult) ? x : ::Io::Flow::V0::Models::AuthorizationResult.new(x))
9975
- @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
9976
- end
9977
-
9978
- def to_json
9979
- JSON.dump(to_hash)
9980
- end
9981
-
9982
- def copy(incoming={})
9983
- Authorization.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
9984
- end
9985
-
9986
- def to_hash
9987
- {
9988
- :id => id,
9989
- :key => key,
9990
- :card => card.nil? ? nil : card.to_hash,
9991
- :amount => amount,
9992
- :currency => currency,
9993
- :customer => customer.to_hash,
9994
- :attributes => attributes,
9995
- :destination => destination.nil? ? nil : destination.to_hash,
9996
- :order => order.nil? ? nil : order.to_hash,
9997
- :ip => ip,
9998
- :result => result.to_hash,
9999
- :created_at => created_at
10000
- }
10001
- end
10002
-
10003
- end
10004
-
10005
10089
  class AuthorizationDeleteError
10006
10090
 
10007
10091
  attr_reader :code, :messages
@@ -10214,7 +10298,7 @@ module Io
10214
10298
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
10215
10299
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
10216
10300
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ChangeType) ? x : ::Io::Flow::V0::Models::ChangeType.apply(x))
10217
- @authorization = (x = opts.delete(:authorization); x.is_a?(::Io::Flow::V0::Models::Authorization) ? x : ::Io::Flow::V0::Models::Authorization.new(x))
10301
+ @authorization = (x = opts.delete(:authorization); x.is_a?(::Io::Flow::V0::Models::Authorization) ? x : ::Io::Flow::V0::Models::Authorization.from_json(x))
10218
10302
  end
10219
10303
 
10220
10304
  def to_json
@@ -10498,6 +10582,58 @@ module Io
10498
10582
 
10499
10583
  end
10500
10584
 
10585
+ # An authorization is used to check and reserve funds w/ a given payment method.
10586
+ # No funds are actually transferred; once you have you an authorization, you can
10587
+ # capture up to the amount of the authorization.
10588
+ class CardAuthorization < Authorization
10589
+
10590
+ attr_reader :id, :key, :card, :amount, :currency, :customer, :attributes, :destination, :order, :ip, :result, :created_at
10591
+
10592
+ def initialize(incoming={})
10593
+ super(:discriminator => Authorization::Types::CARD_AUTHORIZATION)
10594
+ opts = HttpClient::Helper.symbolize_keys(incoming)
10595
+ HttpClient::Preconditions.require_keys(opts, [:id, :key, :card, :amount, :currency, :customer, :attributes, :result, :created_at], 'CardAuthorization')
10596
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
10597
+ @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
10598
+ @card = (x = opts.delete(:card); x.is_a?(::Io::Flow::V0::Models::ExpandableCard) ? x : ::Io::Flow::V0::Models::ExpandableCard.from_json(x))
10599
+ @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
10600
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
10601
+ @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
10602
+ @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 }
10603
+ @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)))
10604
+ @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationOrderReference) ? x : ::Io::Flow::V0::Models::AuthorizationOrderReference.new(x)))
10605
+ @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
10606
+ @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::AuthorizationResult) ? x : ::Io::Flow::V0::Models::AuthorizationResult.new(x))
10607
+ @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
10608
+ end
10609
+
10610
+ def to_json
10611
+ JSON.dump(to_hash)
10612
+ end
10613
+
10614
+ def copy(incoming={})
10615
+ CardAuthorization.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
10616
+ end
10617
+
10618
+ def subtype_to_hash
10619
+ {
10620
+ :id => id,
10621
+ :key => key,
10622
+ :card => card.to_hash,
10623
+ :amount => amount,
10624
+ :currency => currency,
10625
+ :customer => customer.to_hash,
10626
+ :attributes => attributes,
10627
+ :destination => destination.nil? ? nil : destination.to_hash,
10628
+ :order => order.nil? ? nil : order.to_hash,
10629
+ :ip => ip,
10630
+ :result => result.to_hash,
10631
+ :created_at => created_at
10632
+ }
10633
+ end
10634
+
10635
+ end
10636
+
10501
10637
  class CardDeleted < Event
10502
10638
 
10503
10639
  attr_reader :event_id, :timestamp, :organization, :id
@@ -12208,6 +12344,47 @@ module Io
12208
12344
 
12209
12345
  end
12210
12346
 
12347
+ class DirectOnlinePaymentForm < AuthorizationForm
12348
+
12349
+ attr_reader :method, :amount, :currency, :customer, :key, :attributes, :destination, :ip
12350
+
12351
+ def initialize(incoming={})
12352
+ super(:discriminator => AuthorizationForm::Types::DIRECT_ONLINE_PAYMENT_FORM)
12353
+ opts = HttpClient::Helper.symbolize_keys(incoming)
12354
+ HttpClient::Preconditions.require_keys(opts, [:method, :amount, :currency], 'DirectOnlinePaymentForm')
12355
+ @method = HttpClient::Preconditions.assert_class('method', opts.delete(:method), String)
12356
+ @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
12357
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
12358
+ @customer = (x = opts.delete(:customer); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x)))
12359
+ @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
12360
+ @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
12361
+ @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)))
12362
+ @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
12363
+ end
12364
+
12365
+ def to_json
12366
+ JSON.dump(to_hash)
12367
+ end
12368
+
12369
+ def copy(incoming={})
12370
+ DirectOnlinePaymentForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
12371
+ end
12372
+
12373
+ def subtype_to_hash
12374
+ {
12375
+ :method => method,
12376
+ :amount => amount,
12377
+ :currency => currency,
12378
+ :customer => customer.nil? ? nil : customer.to_hash,
12379
+ :key => key,
12380
+ :attributes => attributes.nil? ? nil : attributes,
12381
+ :destination => destination.nil? ? nil : destination.to_hash,
12382
+ :ip => ip
12383
+ }
12384
+ end
12385
+
12386
+ end
12387
+
12211
12388
  # Represents a duration of time.
12212
12389
  class Duration
12213
12390
 
@@ -12359,11 +12536,12 @@ module Io
12359
12536
  end
12360
12537
 
12361
12538
  # Experiences define a local experience for a given geographic region
12362
- class Experience
12539
+ class Experience < ExpandableExperience
12363
12540
 
12364
12541
  attr_reader :id, :key, :name, :delivered_duty, :region, :country, :currency, :language, :measurement_system, :subcatalog, :position, :settings
12365
12542
 
12366
12543
  def initialize(incoming={})
12544
+ super(:discriminator => ExpandableExperience::Types::EXPERIENCE)
12367
12545
  opts = HttpClient::Helper.symbolize_keys(incoming)
12368
12546
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :name, :delivered_duty, :region, :country, :currency, :language, :measurement_system, :subcatalog, :position, :settings], 'Experience')
12369
12547
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
@@ -12385,10 +12563,10 @@ module Io
12385
12563
  end
12386
12564
 
12387
12565
  def copy(incoming={})
12388
- Experience.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
12566
+ Experience.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
12389
12567
  end
12390
12568
 
12391
- def to_hash
12569
+ def subtype_to_hash
12392
12570
  {
12393
12571
  :id => id,
12394
12572
  :key => key,
@@ -12552,11 +12730,12 @@ module Io
12552
12730
 
12553
12731
  end
12554
12732
 
12555
- class ExperienceReference
12733
+ class ExperienceReference < ExpandableExperience
12556
12734
 
12557
12735
  attr_reader :id
12558
12736
 
12559
12737
  def initialize(incoming={})
12738
+ super(:discriminator => ExpandableExperience::Types::EXPERIENCE_REFERENCE)
12560
12739
  opts = HttpClient::Helper.symbolize_keys(incoming)
12561
12740
  HttpClient::Preconditions.require_keys(opts, [:id], 'ExperienceReference')
12562
12741
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
@@ -12567,10 +12746,10 @@ module Io
12567
12746
  end
12568
12747
 
12569
12748
  def copy(incoming={})
12570
- ExperienceReference.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
12749
+ ExperienceReference.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
12571
12750
  end
12572
12751
 
12573
- def to_hash
12752
+ def subtype_to_hash
12574
12753
  {
12575
12754
  :id => id
12576
12755
  }
@@ -16677,7 +16856,7 @@ module Io
16677
16856
  # you can capture up to the amount of the authorization
16678
16857
  class MerchantOfRecordAuthorizationForm < AuthorizationForm
16679
16858
 
16680
- attr_reader :token, :order_number, :key, :cvv, :attributes, :ip, :options
16859
+ attr_reader :token, :order_number, :amount, :currency, :key, :cvv, :attributes, :ip, :options
16681
16860
 
16682
16861
  def initialize(incoming={})
16683
16862
  super(:discriminator => AuthorizationForm::Types::MERCHANT_OF_RECORD_AUTHORIZATION_FORM)
@@ -16685,6 +16864,8 @@ module Io
16685
16864
  HttpClient::Preconditions.require_keys(opts, [:token, :order_number], 'MerchantOfRecordAuthorizationForm')
16686
16865
  @token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String)
16687
16866
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
16867
+ @amount = (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(x), BigDecimal))
16868
+ @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
16688
16869
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
16689
16870
  @cvv = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, String))
16690
16871
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
@@ -16704,6 +16885,8 @@ module Io
16704
16885
  {
16705
16886
  :token => token,
16706
16887
  :order_number => order_number,
16888
+ :amount => amount,
16889
+ :currency => currency,
16707
16890
  :key => key,
16708
16891
  :cvv => cvv,
16709
16892
  :attributes => attributes.nil? ? nil : attributes,
@@ -16714,6 +16897,45 @@ module Io
16714
16897
 
16715
16898
  end
16716
16899
 
16900
+ class MerchantOfRecordOnlinePaymentForm < AuthorizationForm
16901
+
16902
+ attr_reader :method, :order_number, :amount, :currency, :key, :attributes, :ip
16903
+
16904
+ def initialize(incoming={})
16905
+ super(:discriminator => AuthorizationForm::Types::MERCHANT_OF_RECORD_ONLINE_PAYMENT_FORM)
16906
+ opts = HttpClient::Helper.symbolize_keys(incoming)
16907
+ HttpClient::Preconditions.require_keys(opts, [:method, :order_number, :amount, :currency], 'MerchantOfRecordOnlinePaymentForm')
16908
+ @method = HttpClient::Preconditions.assert_class('method', opts.delete(:method), String)
16909
+ @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
16910
+ @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
16911
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
16912
+ @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
16913
+ @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
16914
+ @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
16915
+ end
16916
+
16917
+ def to_json
16918
+ JSON.dump(to_hash)
16919
+ end
16920
+
16921
+ def copy(incoming={})
16922
+ MerchantOfRecordOnlinePaymentForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
16923
+ end
16924
+
16925
+ def subtype_to_hash
16926
+ {
16927
+ :method => method,
16928
+ :order_number => order_number,
16929
+ :amount => amount,
16930
+ :currency => currency,
16931
+ :key => key,
16932
+ :attributes => attributes.nil? ? nil : attributes,
16933
+ :ip => ip
16934
+ }
16935
+ end
16936
+
16937
+ end
16938
+
16717
16939
  # Money represents an amount in a given currency
16718
16940
  class Money
16719
16941
 
@@ -16895,6 +17117,55 @@ module Io
16895
17117
 
16896
17118
  end
16897
17119
 
17120
+ class OnlineAuthorization < Authorization
17121
+
17122
+ attr_reader :id, :key, :method, :amount, :currency, :customer, :attributes, :destination, :order, :ip, :result, :created_at
17123
+
17124
+ def initialize(incoming={})
17125
+ super(:discriminator => Authorization::Types::ONLINE_AUTHORIZATION)
17126
+ opts = HttpClient::Helper.symbolize_keys(incoming)
17127
+ HttpClient::Preconditions.require_keys(opts, [:id, :key, :method, :amount, :currency, :customer, :attributes, :result, :created_at], 'OnlineAuthorization')
17128
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
17129
+ @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
17130
+ @method = HttpClient::Preconditions.assert_class('method', opts.delete(:method), String)
17131
+ @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
17132
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
17133
+ @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
17134
+ @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 }
17135
+ @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)))
17136
+ @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationOrderReference) ? x : ::Io::Flow::V0::Models::AuthorizationOrderReference.new(x)))
17137
+ @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
17138
+ @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::AuthorizationResult) ? x : ::Io::Flow::V0::Models::AuthorizationResult.new(x))
17139
+ @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
17140
+ end
17141
+
17142
+ def to_json
17143
+ JSON.dump(to_hash)
17144
+ end
17145
+
17146
+ def copy(incoming={})
17147
+ OnlineAuthorization.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
17148
+ end
17149
+
17150
+ def subtype_to_hash
17151
+ {
17152
+ :id => id,
17153
+ :key => key,
17154
+ :method => method,
17155
+ :amount => amount,
17156
+ :currency => currency,
17157
+ :customer => customer.to_hash,
17158
+ :attributes => attributes,
17159
+ :destination => destination.nil? ? nil : destination.to_hash,
17160
+ :order => order.nil? ? nil : order.to_hash,
17161
+ :ip => ip,
17162
+ :result => result.to_hash,
17163
+ :created_at => created_at
17164
+ }
17165
+ end
17166
+
17167
+ end
17168
+
16898
17169
  class OptionWeightEstimates
16899
17170
 
16900
17171
  attr_reader :gravitational, :dimensional
@@ -16964,13 +17235,14 @@ module Io
16964
17235
  # payment authorization for an order.
16965
17236
  class Order
16966
17237
 
16967
- attr_reader :id, :number, :customer, :delivered_duty, :destination, :expires_at, :items, :deliveries, :selections, :prices, :total, :attributes, :submitted_at, :lines, :identifiers, :promotions
17238
+ attr_reader :id, :number, :experience, :customer, :delivered_duty, :destination, :expires_at, :items, :deliveries, :selections, :prices, :total, :attributes, :submitted_at, :lines, :identifiers, :promotions
16968
17239
 
16969
17240
  def initialize(incoming={})
16970
17241
  opts = HttpClient::Helper.symbolize_keys(incoming)
16971
17242
  HttpClient::Preconditions.require_keys(opts, [:id, :number, :customer, :delivered_duty, :destination, :expires_at, :items, :deliveries, :selections, :prices, :total, :attributes], 'Order')
16972
17243
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
16973
17244
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
17245
+ @experience = (x = opts.delete(:experience); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExpandableExperience) ? x : ::Io::Flow::V0::Models::ExpandableExperience.from_json(x)))
16974
17246
  @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
16975
17247
  @delivered_duty = (x = opts.delete(:delivered_duty); x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x))
16976
17248
  @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::OrderAddress) ? x : ::Io::Flow::V0::Models::OrderAddress.new(x))
@@ -16999,6 +17271,7 @@ module Io
16999
17271
  {
17000
17272
  :id => id,
17001
17273
  :number => number,
17274
+ :experience => experience.nil? ? nil : experience.to_hash,
17002
17275
  :customer => customer.to_hash,
17003
17276
  :delivered_duty => delivered_duty.value,
17004
17277
  :destination => destination.to_hash,
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.2
4
+ version: 0.2.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: 2017-03-25 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json