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
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions lib/podio/models/stream_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ def find_all_by_app_id(app_id, options={})
}.body
end

# @see https://developers.podio.com/doc/stream/get-application-stream-v3-100406563
def find_all_by_app_id_v3(app_id, options={})
list Podio.connection.get { |req|
req.url("/stream/app/#{app_id}/v3/", options)
}.body
end

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

# @see https://developers.podio.com/doc/stream/get-user-stream-1289318
def find_all_by_user_id(user_id, options={})
list Podio.connection.get { |req|
Expand Down