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

view_id or filters params in Item.item_count #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/podio/models/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ def find_field_top(field_id, options={:limit => 8})
end

# @see https://developers.podio.com/doc/items/get-item-count-34819997
def item_count(app_id)
Podio.connection.get("/item/app/#{app_id}/count/").body
# options are either filters {gender: 1, firstname: "Joe"} or a view {view_id: 123}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding option specifics in the code is discouraged. These may be the options now, but not guaranteed in the future. The API docs should be the source of reference.

def item_count(app_id, options = {})
Podio.connection.get { |req|
req.url("/item/app/#{app_id}/count", options)
}.body
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good except please follow the pattern of the other methods for consistency. Assign the response to a response variable and implicitly return response.body

end

# @see https://developers.podio.com/doc/items/get-items-as-xlsx-63233
Expand Down