flowcommerce 0.0.38 → 0.0.39

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.
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
- # Service version: 0.1.11
3
- # apidoc:0.11.34 http://www.apidoc.me/flow/api/0.1.11/ruby_client
2
+ # Service version: 0.1.12
3
+ # apidoc:0.11.34 http://www.apidoc.me/flow/api/0.1.12/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -25,8 +25,8 @@ 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.34 http://www.apidoc.me/flow/api/0.1.11/ruby_client' unless defined?(Constants::USER_AGENT)
29
- VERSION = '0.1.11' unless defined?(Constants::VERSION)
28
+ USER_AGENT = 'apidoc:0.11.34 http://www.apidoc.me/flow/api/0.1.12/ruby_client' unless defined?(Constants::USER_AGENT)
29
+ VERSION = '0.1.12' unless defined?(Constants::VERSION)
30
30
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
31
31
 
32
32
  end
@@ -3463,59 +3463,6 @@ module Io
3463
3463
 
3464
3464
  module Models
3465
3465
 
3466
- # Represents all possible responses from an authorization attempt
3467
- class AuthorizationDetails
3468
-
3469
- module Types
3470
- AUTHORIZATION_DETAILS_DECLINE = 'authorization_details_decline' unless defined?(AUTHORIZATION_DETAILS_DECLINE)
3471
- AUTHORIZATION_DETAILS_SUCCESS = 'authorization_details_success' unless defined?(AUTHORIZATION_DETAILS_SUCCESS)
3472
- end
3473
-
3474
- def initialize(incoming={})
3475
- opts = HttpClient::Helper.symbolize_keys(incoming)
3476
- HttpClient::Preconditions.require_keys(opts, [:name], 'AuthorizationDetails')
3477
- @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
3478
- end
3479
-
3480
- def to_hash
3481
- subtype_to_hash.merge(:discriminator => @name)
3482
- end
3483
-
3484
- def AuthorizationDetails.from_json(hash)
3485
- HttpClient::Preconditions.assert_class('hash', hash, Hash)
3486
- case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
3487
- when Types::AUTHORIZATION_DETAILS_DECLINE; AuthorizationDetailsDecline.new(hash)
3488
- when Types::AUTHORIZATION_DETAILS_SUCCESS; AuthorizationDetailsSuccess.new(hash)
3489
- else AuthorizationDetailsUndefinedType.new(:name => union_type_name)
3490
- end
3491
- end
3492
-
3493
- end
3494
-
3495
- class AuthorizationDetailsUndefinedType < AuthorizationDetails
3496
-
3497
- attr_reader :name
3498
-
3499
- def initialize(incoming={})
3500
- super(:name => 'undefined_type')
3501
- opts = HttpClient::Helper.symbolize_keys(incoming)
3502
- @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
3503
- end
3504
-
3505
- def subtype_to_hash
3506
- raise 'Unable to serialize undefined type to json'
3507
- end
3508
-
3509
- def copy(incoming={})
3510
- raise 'Operation not supported for undefined type'
3511
- end
3512
-
3513
- def to_hash
3514
- raise 'Operation not supported for undefined type'
3515
- end
3516
-
3517
- end
3518
-
3519
3466
  # Flow provides several different options for creating an authorization
3520
3467
  class AuthorizationForm
3521
3468
 
@@ -4105,6 +4052,57 @@ module Io
4105
4052
 
4106
4053
  end
4107
4054
 
4055
+ class AuthorizationStatus
4056
+
4057
+ attr_reader :value
4058
+
4059
+ def initialize(value)
4060
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
4061
+ end
4062
+
4063
+ # Returns the instance of AuthorizationStatus for this value, creating a new instance for an unknown value
4064
+ def AuthorizationStatus.apply(value)
4065
+ if value.instance_of?(AuthorizationStatus)
4066
+ value
4067
+ else
4068
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
4069
+ value.nil? ? nil : (from_string(value) || AuthorizationStatus.new(value))
4070
+ end
4071
+ end
4072
+
4073
+ # Returns the instance of AuthorizationStatus for this value, or nil if not found
4074
+ def AuthorizationStatus.from_string(value)
4075
+ HttpClient::Preconditions.assert_class('value', value, String)
4076
+ AuthorizationStatus.ALL.find { |v| v.value == value }
4077
+ end
4078
+
4079
+ def AuthorizationStatus.ALL
4080
+ @@all ||= [AuthorizationStatus.accepted, AuthorizationStatus.declined, AuthorizationStatus.pending]
4081
+ end
4082
+
4083
+ # Authorization was successful
4084
+ def AuthorizationStatus.accepted
4085
+ @@_accepted ||= AuthorizationStatus.new('accepted')
4086
+ end
4087
+
4088
+ # Unable to authorize funds
4089
+ def AuthorizationStatus.declined
4090
+ @@_declined ||= AuthorizationStatus.new('declined')
4091
+ end
4092
+
4093
+ # If an immediate response is not available, the state will be 'pending' - this
4094
+ # usually indicates fraud review requires additional time / verification (or a
4095
+ # potential network issue with the issuing bank)
4096
+ def AuthorizationStatus.pending
4097
+ @@_pending ||= AuthorizationStatus.new('pending')
4098
+ end
4099
+
4100
+ def to_hash
4101
+ value
4102
+ end
4103
+
4104
+ end
4105
+
4108
4106
  class AvsCode
4109
4107
 
4110
4108
  attr_reader :value
@@ -4261,21 +4259,17 @@ module Io
4261
4259
  end
4262
4260
 
4263
4261
  def CardType.ALL
4264
- @@all ||= [CardType.visa, CardType.mastercard, CardType.american_express, CardType.dankort, CardType.diners_club, CardType.discover, CardType.jcb, CardType.china_union_pay]
4265
- end
4266
-
4267
- def CardType.visa
4268
- @@_visa ||= CardType.new('visa')
4269
- end
4270
-
4271
- def CardType.mastercard
4272
- @@_mastercard ||= CardType.new('mastercard')
4262
+ @@all ||= [CardType.american_express, CardType.china_union_pay, CardType.dankort, CardType.diners_club, CardType.discover, CardType.jcb, CardType.maestro, CardType.mastercard, CardType.visa]
4273
4263
  end
4274
4264
 
4275
4265
  def CardType.american_express
4276
4266
  @@_american_express ||= CardType.new('american_express')
4277
4267
  end
4278
4268
 
4269
+ def CardType.china_union_pay
4270
+ @@_china_union_pay ||= CardType.new('china_union_pay')
4271
+ end
4272
+
4279
4273
  def CardType.dankort
4280
4274
  @@_dankort ||= CardType.new('dankort')
4281
4275
  end
@@ -4292,8 +4286,16 @@ module Io
4292
4286
  @@_jcb ||= CardType.new('jcb')
4293
4287
  end
4294
4288
 
4295
- def CardType.china_union_pay
4296
- @@_china_union_pay ||= CardType.new('china_union_pay')
4289
+ def CardType.maestro
4290
+ @@_maestro ||= CardType.new('maestro')
4291
+ end
4292
+
4293
+ def CardType.mastercard
4294
+ @@_mastercard ||= CardType.new('mastercard')
4295
+ end
4296
+
4297
+ def CardType.visa
4298
+ @@_visa ||= CardType.new('visa')
4297
4299
  end
4298
4300
 
4299
4301
  def to_hash
@@ -6158,11 +6160,11 @@ module Io
6158
6160
  # capture up to the amount of the authorization.
6159
6161
  class Authorization
6160
6162
 
6161
- attr_reader :id, :key, :card, :amount, :currency, :customer, :attributes, :destination, :ip, :cvv, :details
6163
+ attr_reader :id, :key, :card, :amount, :currency, :customer, :attributes, :destination, :ip, :cvv, :result
6162
6164
 
6163
6165
  def initialize(incoming={})
6164
6166
  opts = HttpClient::Helper.symbolize_keys(incoming)
6165
- HttpClient::Preconditions.require_keys(opts, [:id, :key, :card, :amount, :currency, :customer, :attributes, :details], 'Authorization')
6167
+ HttpClient::Preconditions.require_keys(opts, [:id, :key, :card, :amount, :currency, :customer, :attributes, :result], 'Authorization')
6166
6168
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
6167
6169
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
6168
6170
  @card = (x = opts.delete(:card); x.is_a?(::Io::Flow::V0::Models::CardReference) ? x : ::Io::Flow::V0::Models::CardReference.new(x))
@@ -6173,7 +6175,7 @@ module Io
6173
6175
  @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)))
6174
6176
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
6175
6177
  @cvv = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, String))
6176
- @details = (x = opts.delete(:details); x.is_a?(::Io::Flow::V0::Models::AuthorizationDetails) ? x : ::Io::Flow::V0::Models::AuthorizationDetails.from_json(x))
6178
+ @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::AuthorizationResult) ? x : ::Io::Flow::V0::Models::AuthorizationResult.new(x))
6177
6179
  end
6178
6180
 
6179
6181
  def to_json
@@ -6196,24 +6198,20 @@ module Io
6196
6198
  :destination => destination.nil? ? nil : destination.to_hash,
6197
6199
  :ip => ip,
6198
6200
  :cvv => cvv,
6199
- :details => details.to_hash
6201
+ :result => result.to_hash
6200
6202
  }
6201
6203
  end
6202
6204
 
6203
6205
  end
6204
6206
 
6205
- # Represents a declined authorization
6206
- class AuthorizationDetailsDecline < AuthorizationDetails
6207
+ class AuthorizationReference
6207
6208
 
6208
- attr_reader :reason, :avs, :cvv
6209
+ attr_reader :id
6209
6210
 
6210
6211
  def initialize(incoming={})
6211
- super(:name => AuthorizationDetails::Types::AUTHORIZATION_DETAILS_DECLINE)
6212
6212
  opts = HttpClient::Helper.symbolize_keys(incoming)
6213
- HttpClient::Preconditions.require_keys(opts, [:reason], 'AuthorizationDetailsDecline')
6214
- @reason = HttpClient::Preconditions.assert_class('reason', opts.delete(:reason), String)
6215
- @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)))
6216
- @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)))
6213
+ HttpClient::Preconditions.require_keys(opts, [:id], 'AuthorizationReference')
6214
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
6217
6215
  end
6218
6216
 
6219
6217
  def to_json
@@ -6221,27 +6219,30 @@ module Io
6221
6219
  end
6222
6220
 
6223
6221
  def copy(incoming={})
6224
- AuthorizationDetailsDecline.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
6222
+ AuthorizationReference.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
6225
6223
  end
6226
6224
 
6227
- def subtype_to_hash
6225
+ def to_hash
6228
6226
  {
6229
- :reason => reason,
6230
- :avs => avs.nil? ? nil : avs.to_hash,
6231
- :cvv => cvv.nil? ? nil : cvv.to_hash
6227
+ :id => id
6232
6228
  }
6233
6229
  end
6234
6230
 
6235
6231
  end
6236
6232
 
6237
- # Represents a successful authorization
6238
- class AuthorizationDetailsSuccess < AuthorizationDetails
6233
+ # Contains the result of the authorization. Each authorization will eventually
6234
+ # end in a status of 'accepted' or 'declined'. If an immediate response is not
6235
+ # available, the state will be 'pending' - this usually indicates fraud review
6236
+ # requires additional time / verification (or a potential network issue with the
6237
+ # issuing bank).
6238
+ class AuthorizationResult
6239
6239
 
6240
- attr_reader :avs, :cvv
6240
+ attr_reader :status, :avs, :cvv
6241
6241
 
6242
6242
  def initialize(incoming={})
6243
- super(:name => AuthorizationDetails::Types::AUTHORIZATION_DETAILS_SUCCESS)
6244
6243
  opts = HttpClient::Helper.symbolize_keys(incoming)
6244
+ HttpClient::Preconditions.require_keys(opts, [:status], 'AuthorizationResult')
6245
+ @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::AuthorizationStatus) ? x : ::Io::Flow::V0::Models::AuthorizationStatus.apply(x))
6245
6246
  @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)))
6246
6247
  @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)))
6247
6248
  end
@@ -6251,11 +6252,12 @@ module Io
6251
6252
  end
6252
6253
 
6253
6254
  def copy(incoming={})
6254
- AuthorizationDetailsSuccess.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
6255
+ AuthorizationResult.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
6255
6256
  end
6256
6257
 
6257
- def subtype_to_hash
6258
+ def to_hash
6258
6259
  {
6260
+ :status => status.value,
6259
6261
  :avs => avs.nil? ? nil : avs.to_hash,
6260
6262
  :cvv => cvv.nil? ? nil : cvv.to_hash
6261
6263
  }
@@ -6263,32 +6265,6 @@ module Io
6263
6265
 
6264
6266
  end
6265
6267
 
6266
- class AuthorizationReference
6267
-
6268
- attr_reader :id
6269
-
6270
- def initialize(incoming={})
6271
- opts = HttpClient::Helper.symbolize_keys(incoming)
6272
- HttpClient::Preconditions.require_keys(opts, [:id], 'AuthorizationReference')
6273
- @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
6274
- end
6275
-
6276
- def to_json
6277
- JSON.dump(to_hash)
6278
- end
6279
-
6280
- def copy(incoming={})
6281
- AuthorizationReference.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
6282
- end
6283
-
6284
- def to_hash
6285
- {
6286
- :id => id
6287
- }
6288
- end
6289
-
6290
- end
6291
-
6292
6268
  class AuthorizationVersion
6293
6269
 
6294
6270
  attr_reader :id, :timestamp, :type, :authorization
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flowcommerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38
4
+ version: 0.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flow Commerce, Inc.
@@ -45,6 +45,7 @@ extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
47
  - README.md
48
+ - lib/flow_commerce/#flow_api_v0_client.rb#
48
49
  - lib/flow_commerce/client.rb
49
50
  - lib/flow_commerce/flow_api_v0_client.rb
50
51
  - lib/flowcommerce.rb