Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve total and total_pages pagination metadata from search method #41

Closed
wants to merge 1 commit into from

Conversation

gustavosobral
Copy link
Contributor

Closes #40

@aaronklaassen
Copy link
Member

@gustavosobral Yeah you're right this should be fixed, but I'm hesitant to bump a major version for it (i.e. break the return value of the #search methods).

Another option might be to create a SearchResult class that delegates to the existing array, but also has some attr_readers on it for the totals. Something like:

class SearchResult < SimpleDelegator
  attr_reader :total, :total_pages
end

# Photo
def search(...)
  results = get().parse().whatever # Array
  SearchResult.new(results)
end

^ I mean that's fuzzy, obviously. But does that makes sense?

@aaronklaassen
Copy link
Member

Closing this due to #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants