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

Favourite filters for the user #350

Open
wants to merge 3 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
2 changes: 1 addition & 1 deletion lib/jira/base_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.delegate_to_target_class(*method_names)
# The principle purpose of this class is to delegate methods to the corresponding
# non-factory class and automatically prepend the client argument to the argument
# list.
delegate_to_target_class :all, :find, :collection_path, :singular_path, :jql, :get_backlog_issues, :get_board_issues, :get_sprints, :get_sprint_issues, :get_projects, :get_projects_full
delegate_to_target_class :all, :find, :collection_path, :singular_path, :jql, :get_backlog_issues, :get_board_issues, :get_sprints, :get_sprint_issues, :get_projects, :get_projects_full, :favourites

# This method needs special handling as it has a default argument value
def build(attrs = {})
Expand Down
9 changes: 9 additions & 0 deletions lib/jira/resource/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ class Filter < JIRA::Base
def issues
Issue.jql(client, jql)
end

# Returns all the favourite filters for the user
def self.favourites(client, options = {})
search_url = client.options[:rest_base_path] + '/filter/favourite'
response = client.get(url_with_query_params(search_url, options))

json = parse_json(response.body)
client.Filter.build(json)
end
end
end
end