Skip to content

Commit

Permalink
Undo list change for endpoints without cursors
Browse files Browse the repository at this point in the history
  • Loading branch information
mrashed-dev committed Feb 7, 2024
1 parent 5107ee3 commit 59ed26a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 31 deletions.
4 changes: 2 additions & 2 deletions lib/nylas/resources/connectors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def initialize(sdk_instance)
# Return all connectors.
#
# @param query_params [Hash, nil] Query params to pass to the request.
# @return [Array(Array(Hash), String, String)] The list of connectors, API Request ID, and next cursor.
# @return [Array(Array(Hash), String)] The list of connectors and API Request ID.
def list(query_params: nil)
get_list(
get(
path: "#{api_uri}/v3/connectors",
query_params: query_params
)
Expand Down
4 changes: 2 additions & 2 deletions lib/nylas/resources/credentials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class Credentials < Resource
#
# @param provider [String] The provider associated to the credential to list from
# @param query_params [Hash, nil] Query params to pass to the request.
# @return [Array(Array(Hash), String, String)] The list of credentials, API Request ID, and next cursor.
# @return [Array(Array(Hash), String)] The list of credentials and API Request ID.
def list(provider:, query_params: nil)
get_list(
get(
path: "#{api_uri}/v3/connectors/#{provider}/creds",
query_params: query_params
)
Expand Down
4 changes: 2 additions & 2 deletions lib/nylas/resources/grants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class Grants < Resource
# Return all grants.
#
# @param query_params [Hash, nil] Query params to pass to the request.
# @return [Array(Array(Hash), String, String)] The list of grants, API Request ID, and next cursor.
# @return [Array(Array(Hash), String)] The list of grants and API Request ID.
def list(query_params: nil)
get_list(
get(
path: "#{api_uri}/v3/grants",
query_params: query_params
)
Expand Down
4 changes: 2 additions & 2 deletions lib/nylas/resources/redirect_uris.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class RedirectUris < Resource

# Return all redirect uris.
#
# @return [Array(Array(Hash), String, String)] The list of redirect uris, API Request ID, and next cursor.
# @return [Array(Array(Hash), String)] The list of redirect uris and API Request ID.
def list
get_list(
get(
path: "#{api_uri}/v3/applications/redirect-uris"
)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/nylas/resources/webhooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class Webhooks < Resource

# Return all webhooks.
#
# @return [Array(Array(Hash), String, String)] The list of webhooks, API Request ID, and next cursor.
# @return [Array(Array(Hash), String)] The list of webhooks and API Request ID.
def list
get_list(
get(
path: "#{api_uri}/v3/webhooks"
)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/nylas/resources/connectors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

describe "#list" do
let(:list_response) do
[[response[0]], response[1], "mock_next_cursor"]
[[response[0]], response[1]]
end

it "calls the get method with the correct parameters" do
path = "#{api_uri}/v3/connectors"
allow(connectors).to receive(:get_list)
allow(connectors).to receive(:get)
.with(path: path, query_params: nil)
.and_return(list_response)

Expand All @@ -35,7 +35,7 @@
it "calls the get method with the correct parameters and query params" do
path = "#{api_uri}/v3/connectors"
query_params = { foo: "bar" }
allow(connectors).to receive(:get_list)
allow(connectors).to receive(:get)
.with(path: path, query_params: query_params)
.and_return(list_response)

Expand Down
6 changes: 3 additions & 3 deletions spec/nylas/resources/credentials_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

describe "#list" do
let(:list_response) do
[[response[0]], response[1], "mock_next_cursor"]
[[response[0]], response[1]]
end

it "calls the get method with the correct parameters" do
provider = "google"
path = "#{api_uri}/v3/connectors/#{provider}/creds"
allow(credentials).to receive(:get_list)
allow(credentials).to receive(:get)
.with(path: path, query_params: nil)
.and_return(list_response)

Expand All @@ -32,7 +32,7 @@
provider = "google"
path = "#{api_uri}/v3/connectors/#{provider}/creds"
query_params = { foo: "bar" }
allow(credentials).to receive(:get_list)
allow(credentials).to receive(:get)
.with(path: path, query_params: query_params)
.and_return(list_response)

Expand Down
7 changes: 2 additions & 5 deletions spec/nylas/resources/grants_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
end

describe "#list" do
let(:list_response) do
[[response[0]], response[1], "mock_next_cursor"]
end

it "calls the get method with the correct parameters" do
path = "#{api_uri}/v3/grants"
allow(grants).to receive(:get_list)
list_response = [[response[0]], response[1]]
allow(grants).to receive(:get)
.with(path: path, query_params: nil)
.and_return(list_response)

Expand Down
7 changes: 2 additions & 5 deletions spec/nylas/resources/redirect_uris_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
end

describe "#list" do
let(:list_response) do
[[response[0]], response[1], "mock_next_cursor"]
end

it "calls the get method with the correct parameters" do
path = "#{api_uri}/v3/applications/redirect-uris"
allow(redirect_uris).to receive(:get_list)
list_response = [[response[0]], response[1]]
allow(redirect_uris).to receive(:get)
.with(path: path)
.and_return(list_response)

Expand Down
7 changes: 2 additions & 5 deletions spec/nylas/resources/webhooks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
end

describe "#list" do
let(:list_response) do
[[response[0]], response[1], "mock_next_cursor"]
end

it "calls the get method with the correct parameters" do
path = "#{api_uri}/v3/webhooks"
allow(webhooks).to receive(:get_list)
list_response = [[response[0]], response[1]]
allow(webhooks).to receive(:get)
.with(path: path)
.and_return(list_response)

Expand Down

0 comments on commit 59ed26a

Please sign in to comment.