Project

General

Profile

« Previous | Next » 

Revision 0889fa03

Added by Justin Sherrill over 8 years ago

fixes #11773 - allow false values for :include_repos

View differences:

lib/runcible/extensions/unit.rb
# @param [Array] id the content ID of the content to retrieve
# @return [RestClient::Response] the requested content
def find(id, optional = {})
optional[:include_repos] ||= true
find_all([id], optional).first
end
......
# @param [Array] ids list of content IDs to retrieve
# @return [RestClient::Response] list of content
def find_all(ids, optional = {})
optional[:include_repos] ||= true
optional[:include_repos] = optional.fetch(:include_repos, true)
search(content_type, { :filters => {'id' => {'$in' => ids}} }, optional)
end
......
# @param [Array] id the unit ID of the content to retrieve
# @return [RestClient::Response] the requested content
def find_by_unit_id(id, optional = {})
optional[:include_repos] ||= true
find_all_by_unit_ids([id], [], optional).first
end
......
# @param [Array] fields optional list of to retrieve
# @return [RestClient::Response] list of content
def find_all_by_unit_ids(ids, fields = [], optional = {})
optional[:include_repos] ||= true
optional[:include_repos] = optional.fetch(:include_repos, true)
criteria = { :filters => { :_id => { '$in' => ids } } }
criteria[:fields] = fields unless fields.empty?
search(content_type, criteria, optional)

Also available in: Unified diff