Skip to content

Commit

Permalink
Merge pull request #40 from rlb3/process_page
Browse files Browse the repository at this point in the history
Provide full url to process_page when there is more than 50 entries.
  • Loading branch information
danielberkompas committed Jun 6, 2016
2 parents 9720bfe + 9ad28de commit 1b518db
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ex_twilio/result_stream.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ defmodule ExTwilio.ResultStream do
alias ExTwilio.Api
alias ExTwilio.Parser
alias ExTwilio.UrlGenerator
alias ExTwilio.Config

@type url :: String.t

Expand Down Expand Up @@ -52,13 +53,15 @@ defmodule ExTwilio.ResultStream do
{:halt, nil}
end

defp process_page({nil, next_page_url, module}) do
next_page_url
defp process_page({nil, next_page_uri, module}) do
next_page_url(next_page_uri)
|> fetch_page(module)
|> process_page
end

defp process_page({items, next_page_url, module}) do
{items, {nil, next_page_url, module}}
defp process_page({items, next_page_uri, module}) do
{items, {nil, next_page_uri, module}}
end

defp next_page_url(uri), do: "https://#{Config.api_domain}" <> uri
end

0 comments on commit 1b518db

Please sign in to comment.