You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe we can make interacting with this library a little bit sweeter with some convenience methods.
This is a discussion, not a request for changes...yet.
Ideas:
1:
Iterate over response docs from the response object.
If we have a response object response = Primo.find("otters")
currently we have to navigate to the docs attribute to iterate over the docs response.docs.each {|d| puts d.title }
Would be simpler to just iterate directly from the response object, and would hide some of the internal details about the object. response.each {|d| puts d.title }
2: Not so sure about this one
Expose the top level keys of the JSON response in the response object.
Currently we have to go response.response.keys to get the top level structure of the json response, which is ["highlights", "docs", "timelog", "lang3", "info", "facets", "beaconO22"]
I found it useful when trying to understand what data was available in the response to see what else I might want to dig into.
3: Add some convenience methods for number of results, paging, etc.
Instead of response.info.total we just response.total.
Same for response.info.first, response.info.last etc.
The text was updated successfully, but these errors were encountered:
Maybe we can make interacting with this library a little bit sweeter with some convenience methods.
This is a discussion, not a request for changes...yet.
Ideas:
1:
Iterate over response docs from the response object.
If we have a response object
response = Primo.find("otters")
currently we have to navigate to the docs attribute to iterate over the docs
response.docs.each {|d| puts d.title }
Would be simpler to just iterate directly from the response object, and would hide some of the internal details about the object.
response.each {|d| puts d.title }
2: Not so sure about this one
Expose the top level keys of the JSON response in the response object.
Currently we have to go
response.response.keys
to get the top level structure of the json response, which is["highlights", "docs", "timelog", "lang3", "info", "facets", "beaconO22"]
I found it useful when trying to understand what data was available in the response to see what else I might want to dig into.
3: Add some convenience methods for number of results, paging, etc.
Instead of
response.info.total
we justresponse.total
.Same for
response.info.first
,response.info.last
etc.The text was updated successfully, but these errors were encountered: