Skip to content

Commit

Permalink
Hoist offset and limit options to methods for groups (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
krainboltgreene authored and xhocquet committed Oct 28, 2019
1 parent d261c57 commit fefb746
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions lib/boxr/groups.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Boxr
class Client

def groups(fields: [])
def groups(fields: [], offset: 0, limit: DEFAULT_LIMIT)
query = build_fields_query(fields, GROUP_FIELDS_QUERY)
groups = get_all_with_pagination(GROUPS_URI, query: query, offset: 0, limit: DEFAULT_LIMIT)
groups = get_all_with_pagination(GROUPS_URI, query: query, offset: offset, limit: limit)
end

def group_from_id(group_id, fields: [])
Expand Down Expand Up @@ -39,21 +39,21 @@ def delete_group(group)
result
end

def group_memberships(group)
def group_memberships(group, offset: 0, limit: DEFAULT_LIMIT)
group_id = ensure_id(group)
uri = "#{GROUPS_URI}/#{group_id}/memberships"
memberships = get_all_with_pagination(uri, offset: 0, limit: DEFAULT_LIMIT)
memberships = get_all_with_pagination(uri, offset: offset, limit: limit)
end

def group_memberships_for_user(user)
def group_memberships_for_user(user, offset: 0, limit: DEFAULT_LIMIT)
user_id = ensure_id(user)
uri = "#{USERS_URI}/#{user_id}/memberships"
memberships = get_all_with_pagination(uri, offset: 0, limit: DEFAULT_LIMIT)
memberships = get_all_with_pagination(uri, offset: offset, limit: limit)
end

def group_memberships_for_me
def group_memberships_for_me(offset: 0, limit: DEFAULT_LIMIT)
uri = "#{USERS_URI}/me/memberships"
memberships = get_all_with_pagination(uri, offset: 0, limit: DEFAULT_LIMIT)
memberships = get_all_with_pagination(uri, offset: offset, limit: limit)
end

def group_membership_from_id(membership_id)
Expand Down Expand Up @@ -89,11 +89,11 @@ def delete_group_membership(membership)
result
end

def group_collaborations(group)
def group_collaborations(group, offset: 0, limit: DEFAULT_LIMIT)
group_id = ensure_id(group)
uri = "#{GROUPS_URI}/#{group_id}/collaborations"
collaborations = get_all_with_pagination(uri, offset: 0, limit: DEFAULT_LIMIT)
collaborations = get_all_with_pagination(uri, offset: offset, limit: limit)
end

end
end
end
2 changes: 1 addition & 1 deletion lib/boxr/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Boxr
VERSION = "1.11.0"
VERSION = "1.11.1"
end

0 comments on commit fefb746

Please sign in to comment.