Skip to content
Open
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
16 changes: 8 additions & 8 deletions __tests__/Api/Address.unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
addressApiMock = double("ApiClient")
addressApi = AddressesApi.new(addressApiMock)
addressEditable = AddressEditable.new
fakeAddress = UsAddress.new
fakeAddress = Address.new

fakeAddress.id = "adr_fakeid"
allow(addressApi).to receive(:create) { fakeAddress }
Expand All @@ -62,7 +62,7 @@
it "retrieves an address" do
addressApiMock = double("ApiClient")
addressApi = AddressesApi.new(addressApiMock)
fakeAddress = UsAddress.new
fakeAddress = Address.new

fakeAddress.id = "adr_fakeid"
allow(addressApi).to receive(:get) { fakeAddress }
Expand Down Expand Up @@ -91,7 +91,7 @@
addressApiMock = double("ApiClient")
addressApi = AddressesApi.new(addressApiMock)
addressEditable = AddressEditable.new
fakeAddresses = Array.new(2) { UsAddress.new }
fakeAddresses = Array.new(2) { Address.new }

fakeAddresses[0].id = "adr_fakeid"
allow(addressApi).to receive(:list) { fakeAddresses }
Expand All @@ -106,7 +106,7 @@
addressApiMock = double("ApiClient")
addressApi = AddressesApi.new(addressApiMock)
addressEditable = AddressEditable.new
fakeAddresses = Array.new(2) { UsAddress.new }
fakeAddresses = Array.new(2) { Address.new }

fakeAddresses[0].id = "adr_fakeid"
allow(addressApi).to receive(:list) { fakeAddresses }
Expand All @@ -121,7 +121,7 @@
addressApiMock = double("ApiClient")
addressApi = AddressesApi.new(addressApiMock)
addressEditable = AddressEditable.new
fakeAddresses = Array.new(2) { UsAddress.new }
fakeAddresses = Array.new(2) { Address.new }

fakeAddresses[0].id = "adr_fakeid"
allow(addressApi).to receive(:list) { fakeAddresses }
Expand All @@ -136,7 +136,7 @@
addressApiMock = double("ApiClient")
addressApi = AddressesApi.new(addressApiMock)
addressEditable = AddressEditable.new
fakeAddresses = Array.new(2) { UsAddress.new }
fakeAddresses = Array.new(2) { Address.new }

fakeAddresses[0].id = "adr_fakeid"
allow(addressApi).to receive(:list) { fakeAddresses }
Expand All @@ -151,7 +151,7 @@
addressApiMock = double("ApiClient")
addressApi = AddressesApi.new(addressApiMock)
addressEditable = AddressEditable.new
fakeAddresses = Array.new(2) { UsAddress.new }
fakeAddresses = Array.new(2) { Address.new }

dateFilter = { gt: "2020-01-01", lt: "2020-01-31T12" };
fakeAddresses[0].id = "adr_fakeid"
Expand All @@ -167,7 +167,7 @@
addressApiMock = double("ApiClient")
addressApi = AddressesApi.new(addressApiMock)
addressEditable = AddressEditable.new
fakeAddresses = Array.new(2) { UsAddress.new }
fakeAddresses = Array.new(2) { Address.new }

metadata = { fakeMetadata: "fakemetadata" }
fakeAddresses[0].id = "adr_fakeid"
Expand Down
6 changes: 3 additions & 3 deletions __tests__/Integration/Address.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@
end

it "lists addresses with after param" do
response = @addressApi.list(limit: 2)
response = @addressApi.list()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This test for pagination is less reliable without a limit parameter. To ensure a paginated response and the presence of a next_page_token, it's better to explicitly set a limit, as was done in the code being reverted.

response = @addressApi.list(limit: 2)

responseAfter = @addressApi.list(after: response.getNextPageToken())
expect(responseAfter.data.length()).to be > 0
end

it "lists addresses with before param" do
response = @addressApi.list(limit: 2)
response = @addressApi.list()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the test for the after parameter, this test for the before parameter is less reliable without an explicit limit. Using a limit ensures that a paginated response is returned, which is necessary for robustly testing pagination.

response = @addressApi.list(limit: 2)

responseAfter = @addressApi.list(before: response.getNextPageToken())
expect(responseAfter.data.length()).to be > 0
end
Expand Down Expand Up @@ -197,4 +197,4 @@
expect(response.deleted).to eq(true)
end
end
end
end
2 changes: 1 addition & 1 deletion __tests__/Integration/Check.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@

expect(response.data[0].id).not_to eq(first_chk_id)

uri = URI.parse(response.previous_url)
uri = URI.parse(response.next_url)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line appears to contain a bug. You are parsing response.next_url but then attempting to extract a before token from it to test before pagination. The next_url contains an after token, not a before token. This will likely cause params["before"] to be nil and raise an error on the following line. You should probably be parsing response.previous_url here to get the before token.

uri    = URI.parse(response.previous_url)

params = CGI.parse(uri.query)

response = @checkApi.list({ :"limit" => 2, :"before" => params["before"][0] })
Expand Down
2 changes: 1 addition & 1 deletion __tests__/Integration/Letter.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@

expect(response.data[0].id).not_to eq(first_ltr_id)

uri = URI.parse(response.previous_url)
uri = URI.parse(response.next_url)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line appears to contain a bug. You are parsing response.next_url but then attempting to extract a before token from it to test before pagination. The next_url contains an after token, not a before token. This will likely cause params["before"] to be nil and raise an error on the following line. You should probably be parsing response.previous_url here to get the before token.

uri    = URI.parse(response.previous_url)

params = CGI.parse(uri.query)

response = @letterApi.list({ :"limit" => 2, :"before" => params["before"][0] })
Expand Down
5 changes: 2 additions & 3 deletions __tests__/Integration/Template.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@

templateWritable3 = TemplateWritable.new({
description: "Ruby Integration Test",
html: "<html>Updated HTML for Ruby Integration Test</html>",
metadata: { name: "Harry" }
html: "<html>Updated HTML for Ruby Integration Test</html>"
})

response1 = @templateApi.create(templateWritable1)
Expand All @@ -124,7 +123,7 @@

expect(response.data[0].id).not_to eq(first_tmpl_id)

uri = URI.parse(response.previous_url)
uri = URI.parse(response.next_url)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line appears to contain a bug. You are parsing response.next_url but then attempting to extract a before token from it to test before pagination. The next_url contains an after token, not a before token. This will likely cause params["before"] to be nil and raise an error on the following line. You should probably be parsing response.previous_url here to get the before token.

uri    = URI.parse(response.previous_url)

params = CGI.parse(uri.query)

response = @templateApi.list({ :"limit" => 2, :"before" => params["before"][0] })
Expand Down
1 change: 1 addition & 0 deletions __tests__/Integration/UsAutocompletion.spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

it "Autocompletes US address (with test key)" do
autocompletedAddr = @usAutocompletionApi.autocomplete(@validAddress)
puts autocompletedAddr.suggestions[0].primary_line

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This puts statement appears to be a leftover debugging statement. It should be removed to keep the test output clean.

expect(autocompletedAddr.suggestions[0].primary_line).to eq("1 TELEGRAPH HILL BLVD")
end

Expand Down
6 changes: 3 additions & 3 deletions docs/Address.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
| **address_line1** | **String** | | [optional] |
| **address_line2** | **String** | | [optional] |
| **address_city** | **String** | | [optional] |
| **address_state** | **String** | 2 letter state short-name code for US address or must be no longer than 200 characters for non-US address. | [optional] |
| **address_zip** | **String** | Must follow the ZIP format of &#x60;12345&#x60; or ZIP+4 format of &#x60;12345-1234&#x60; for US address or must be no longer than 40 characters for non-US address. | [optional] |
| **address_state** | **String** | 2 letter state short-name code | [optional] |
| **address_zip** | **String** | Must follow the ZIP format of &#x60;12345&#x60; or ZIP+4 format of &#x60;12345-1234&#x60;. | [optional] |
Comment on lines +17 to +18

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The descriptions for address_state and address_zip have been updated to reflect US-specific formats. This is misleading for users creating international addresses. The documentation should clarify that these formats are for US addresses and provide guidance for international address formats, or the validation in the model should be updated to handle both.

| **address_country** | [**CountryExtendedExpanded**](CountryExtendedExpanded.md) | | [optional] |
| **object** | **String** | | [optional][default to &#39;address&#39;] |
| **date_created** | **Time** | A timestamp in ISO 8601 format of the date the resource was created. | [optional] |
Expand All @@ -28,7 +28,7 @@
```ruby
require 'lob'

instance = Lob::Address.build(
instance = Lob::Address.new(
id: null,
description: null,
name: null,
Expand Down
4 changes: 2 additions & 2 deletions docs/IntlAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
| **address_line1** | **String** | | [optional] |
| **address_line2** | **String** | | [optional] |
| **address_city** | **String** | | [optional] |
| **address_state** | **String** | Must be no longer than 200 characters. | [optional] |
| **address_zip** | **String** | Must be no longer than 40 characters. | [optional] |
| **address_state** | **String** | 2 letter state short-name code | [optional] |
| **address_zip** | **String** | Must have a maximum of 12 characters | [optional] |
| **address_country** | [**CountryExtendedExpandedNoUs**](CountryExtendedExpandedNoUs.md) | | [optional] |
| **object** | **String** | | [optional][default to &#39;address&#39;] |
| **date_created** | **Time** | A timestamp in ISO 8601 format of the date the resource was created. | [optional] |
Expand Down
3 changes: 0 additions & 3 deletions lib/lob.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
require 'lob/models/cmp_use_type'
require 'lob/models/country_extended'
require 'lob/models/country_extended_expanded'
require 'lob/models/country_extended_expanded_no_us'
require 'lob/models/creative_patch'
require 'lob/models/creative_response'
require 'lob/models/creative_writable'
Expand All @@ -82,7 +81,6 @@
require 'lob/models/http_validation_error'
require 'lob/models/identity_validation'
require 'lob/models/inline_object'
require 'lob/models/intl_address'
require 'lob/models/intl_autocompletions'
require 'lob/models/intl_autocompletions_writable'
require 'lob/models/intl_components'
Expand Down Expand Up @@ -163,7 +161,6 @@
require 'lob/models/upload_updatable'
require 'lob/models/upload_writable'
require 'lob/models/uploads_metadata'
require 'lob/models/us_address'
require 'lob/models/us_autocompletions'
require 'lob/models/us_autocompletions_writable'
require 'lob/models/us_components'
Expand Down
Loading
Loading