Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/Api/BankAccount.unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
it "handles errors returned by the api" do
bankAccountApiMock = double("ApiClient")
bankAccountApi = BankAccountsApi.new(bankAccountApiMock)
bankAccountVerify = BankAccountVerify.new
bankAccountVerify = BankAccountVerify.new(amounts: [11, 35])

allow(bankAccountApi).to receive(:verify).and_raise("exception thrown in verification test")
begin
Expand All @@ -228,7 +228,7 @@
it "verifies a bank account" do
bankAccountApiMock = double("ApiClient")
bankAccountApi = BankAccountsApi.new(bankAccountApiMock)
bankAccountVerify = BankAccountVerify.new
bankAccountVerify = BankAccountVerify.new(amounts: [11, 35])
fakeBankAccount = BankAccount.new
fakeBankAccount.verified = true
fakeBankAccount.id = "bank_fakeId"
Expand Down
36 changes: 36 additions & 0 deletions __tests__/Integration/Postcard.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,38 @@
before(:all) do
api = TestFixtures.api_client_with_test_key()
@postcardApi = PostcardsApi.new(api)

addressEditable1 = AddressEditable.new({
name: "Thing T. Thing",
address_line1: "1313 CEMETERY LN",
address_city: "WESTFIELD",
address_state: "NJ",
address_zip: "07000",
})

addressEditable2 = AddressEditable.new({
name: "FESTER",
address_line1: "001 CEMETERY LN",
address_line2: "SUITE 666",
address_city: "WESTFIELD",
address_state: "NJ",
address_zip: "07000",
})

dummyPostcard = PostcardEditable.new({
to: addressEditable1,
from: addressEditable2,
front: TestFixtures.FILE_LOCATION_4x6,
back: TestFixtures.FILE_LOCATION_4x6,
use_type: 'marketing'
})

response1 = @postcardApi.create(dummyPostcard)
response2 = @postcardApi.create(dummyPostcard)
response3 = @postcardApi.create(dummyPostcard)
response4 = @postcardApi.create(dummyPostcard)
response5 = @postcardApi.create(dummyPostcard)
@postcardIds = [response1.id, response2.id, response3.id, response4.id, response5.id]
end

it "lists postcards with limit, before, and after params" do
Expand Down Expand Up @@ -168,6 +200,10 @@
end
end
end

after(:all) do
@postcardIds.each { |id| @postcardApi.cancel(id) }
end
end

describe "cancel" do
Expand Down
20 changes: 20 additions & 0 deletions __tests__/Integration/SelfMailer.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,31 @@
use_type: SfmUseType::MARKETING
})

selfMailerEditable4 = SelfMailerEditable.new({
to: addr,
inside: TestFixtures.FILE_LOCATION_6X18,
outside: TestFixtures.FILE_LOCATION_6X18,
use_type: SfmUseType::MARKETING
})

selfMailerEditable5 = SelfMailerEditable.new({
to: addr,
inside: TestFixtures.FILE_LOCATION_6X18,
outside: TestFixtures.FILE_LOCATION_6X18,
use_type: SfmUseType::MARKETING
})

response1 = @selfMailerApi.create(selfMailerEditable1)
response2 = @selfMailerApi.create(selfMailerEditable2)
response3 = @selfMailerApi.create(selfMailerEditable3)
response4 = @selfMailerApi.create(selfMailerEditable4)
response5 = @selfMailerApi.create(selfMailerEditable5)

@selfMailer1Id = response1.id
@selfMailer2Id = response2.id
@selfMailer3Id = response3.id
@selfMailer4Id = response4.id
@selfMailer5Id = response5.id
end

it "lists self mailers with limit, before, and after params" do
Expand Down Expand Up @@ -232,6 +250,8 @@
@selfMailerApi.delete(@selfMailer1Id)
@selfMailerApi.delete(@selfMailer2Id)
@selfMailerApi.delete(@selfMailer3Id)
@selfMailerApi.delete(@selfMailer4Id)
@selfMailerApi.delete(@selfMailer5Id)
end
end

Expand Down
19 changes: 15 additions & 4 deletions lib/lob/models/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class BankAccount

attr_accessor :object

# The type of microdeposit verification used for this bank account. Either "amounts" or "descriptor_code", or null once verified.
attr_accessor :microdeposit_type

class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
Expand Down Expand Up @@ -93,7 +96,8 @@ def self.attribute_map
:'date_created' => :'date_created',
:'date_modified' => :'date_modified',
:'deleted' => :'deleted',
:'object' => :'object'
:'object' => :'object',
:'microdeposit_type' => :'microdeposit_type'
}
end

Expand All @@ -118,7 +122,8 @@ def self.openapi_types
:'date_created' => :'Time',
:'date_modified' => :'Time',
:'deleted' => :'Boolean',
:'object' => :'String'
:'object' => :'String',
:'microdeposit_type' => :'String'
}
end

Expand All @@ -127,6 +132,7 @@ def self.openapi_nullable
Set.new([
:'description',
:'signature_url',
:'microdeposit_type',
])
end

Expand Down Expand Up @@ -206,6 +212,10 @@ def initialize(attributes = {})
else
self.object = 'bank_account'
end

if attributes.key?(:'microdeposit_type')
self.microdeposit_type = attributes[:'microdeposit_type']
end
end

# Show invalid properties with the reasons. Usually used together with valid?
Expand Down Expand Up @@ -428,7 +438,8 @@ def ==(o)
date_created == o.date_created &&
date_modified == o.date_modified &&
deleted == o.deleted &&
object == o.object
object == o.object &&
microdeposit_type == o.microdeposit_type
end

# @see the `==` method
Expand All @@ -440,7 +451,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash
[description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object, microdeposit_type].hash
end


Expand Down
82 changes: 69 additions & 13 deletions lib/lob/models/bank_account_verify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ class BankAccountVerify
# In live mode, an array containing the two micro deposits (in cents) placed in the bank account. In test mode, no micro deposits will be placed, so any two integers between `1` and `100` will work.
attr_accessor :amounts

# The 6-character code (beginning with SM) from the bank statement descriptor of the single $0.01 microdeposit. Required when microdeposit_type is descriptor_code.
attr_accessor :descriptor_code

# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'amounts' => :'amounts'
:'amounts' => :'amounts',
:'descriptor_code' => :'descriptor_code'
}
end

Expand All @@ -33,7 +37,8 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
:'amounts' => :'Array<Integer>'
:'amounts' => :'Array<Integer>',
:'descriptor_code' => :'String'
}
end

Expand Down Expand Up @@ -63,22 +68,51 @@ def initialize(attributes = {})
self.amounts = value
end
end

if attributes.key?(:'descriptor_code')
self.descriptor_code = attributes[:'descriptor_code']
end

has_amounts = !@amounts.nil?
has_descriptor_code = !@descriptor_code.nil?

if !has_amounts && !has_descriptor_code
fail ArgumentError, 'one of "amounts" or "descriptor_code" must be provided'
end

if has_amounts && has_descriptor_code
fail ArgumentError, 'only one of "amounts" or "descriptor_code" may be provided'
end
end

# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @amounts.nil?
invalid_properties.push('invalid value for "amounts", amounts cannot be nil.')

if @amounts.nil? && @descriptor_code.nil?
invalid_properties.push('one of "amounts" or "descriptor_code" must be provided')
end

if @amounts.length > 2
invalid_properties.push('invalid value for "amounts", number of items must be less than or equal to 2.')
if !@amounts.nil? && !@descriptor_code.nil?
invalid_properties.push('only one of "amounts" or "descriptor_code" may be provided')
end

if !@amounts.nil?
if @amounts.length > 2
invalid_properties.push('invalid value for "amounts", number of items must be less than or equal to 2.')
end

if @amounts.length < 2
invalid_properties.push('invalid value for "amounts", number of items must be greater than or equal to 2.')
end
end

if @amounts.length < 2
invalid_properties.push('invalid value for "amounts", number of items must be greater than or equal to 2.')
if !@descriptor_code.nil?
pattern = Regexp.new(/^SM[a-zA-Z0-9]{4}$/)
if @descriptor_code !~ pattern
invalid_properties.push("invalid value for \"descriptor_code\", must conform to the pattern #{pattern}.")
end
end

invalid_properties
Expand All @@ -87,9 +121,15 @@ def list_invalid_properties
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @amounts.nil?
return false if @amounts.length > 2
return false if @amounts.length < 2
return false if @amounts.nil? && @descriptor_code.nil?
return false if !@amounts.nil? && !@descriptor_code.nil?
if !@amounts.nil?
return false if @amounts.length > 2
return false if @amounts.length < 2
end
if !@descriptor_code.nil?
return false if @descriptor_code !~ Regexp.new(/^SM[a-zA-Z0-9]{4}$/)
end
true
end

Expand All @@ -111,12 +151,28 @@ def amounts=(amounts)
@amounts = amounts
end

# Custom attribute writer method with validation
# @param [Object] descriptor_code Value to be assigned
def descriptor_code=(descriptor_code)
if descriptor_code.nil?
fail ArgumentError, 'descriptor_code cannot be nil'
end

pattern = Regexp.new(/^SM[a-zA-Z0-9]{4}$/)
if descriptor_code !~ pattern
fail ArgumentError, "invalid value for \"descriptor_code\", must conform to the pattern #{pattern}."
end

@descriptor_code = descriptor_code
end

# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
amounts == o.amounts
amounts == o.amounts &&
descriptor_code == o.descriptor_code
end

# @see the `==` method
Expand All @@ -128,7 +184,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[amounts].hash
[amounts, descriptor_code].hash
end


Expand Down
2 changes: 1 addition & 1 deletion lib/lob/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
=end

module Lob
VERSION = '6.0.9'
VERSION = '6.1.0'
end
Loading
Loading