Sha256: d2598f83e145a70b290a28a57890aef0a87a3dff0f7078406d306f3b6e9028fd
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
require 'active_resource' require_relative 'tracker' require_relative 'collections/base' require_relative 'version' require_relative 'membership' module RedmineRest module Models # # Project model # class Project < ActiveResource::Base self.format = :xml self.collection_parser = Collections::Base has_many :trackers, class_name: Tracker # # Adds trackers to request. # def self.find(scope, options = {}) options[:params] = {} unless options[:params] params = options[:params] if params[:include] params[:include] += ',trackers' else # doubling is not bad params[:include] = 'trackers' end super(scope, options) end def versions Version.all params: { project_id: id } end def memberships Membership.all params: { project_id: id } end def members(options = {}) users = memberships .map { |m| m.user? ? m.user : m.group.reload.users } .flatten users.map(&:reload) if options[:reload] Collections::Base.new(users) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems