Skip to content

Commit

Permalink
add pagination to Tentacat.Organizations.Members.list/3 fixes #210
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic authored and edgurgel committed Dec 20, 2024
1 parent b6b4d9f commit 6add10b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/tentacat/organizations/members.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ defmodule Tentacat.Organizations.Members do
Tentacat.Organizations.Members.list "github"
Tentacat.Organizations.Members.list client, "github"
Tentacat.Organizations.Members.list client, "github", %{page: 2}
More info at: http://developer.github.com/v3/orgs/members/#members-list
"""
@spec list(Client.t(), binary) :: Tentacat.response()
def list(client \\ %Client{}, organization) do
get("orgs/#{organization}/members", client)
@spec list(Client.t(), binary, Keyword.t()) :: Tentacat.response()
def list(client \\ %Client{}, organization, options \\ []) do
get("orgs/#{organization}/members", client, options)
end

@doc """
Expand Down
8 changes: 6 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ defmodule Tentacat.Mixfile do
elixir: "~> 1.16",
name: "Tentacat",
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [coveralls: :test, "coveralls.detail": :test, "coveralls.post": :test],
preferred_cli_env: [coveralls: :test, "coveralls.detail": :test, "coveralls.post": :test, c: :test],
package: package(),
deps: deps(),
docs: docs()
docs: docs(),
aliases: [
t: ["test"],
c: ["coveralls.html"]
]
]
end

Expand Down
7 changes: 7 additions & 0 deletions test/organizations/members_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ defmodule Tentacat.Organizations.MembersTest do
end
end

test "list/3 second page of people" do
use_cassette "members#list_with_params" do
{_, [%{"login" => login}], _} = list(@client, "dwyl", %{page: 2})
assert login == "josephwilk"
end
end

test "member?/3" do
use_cassette "members#member_" do
{status_code, _, _} = member?(@client, "elixir-conspiracy", "josephwilk")
Expand Down

0 comments on commit 6add10b

Please sign in to comment.