Sha256: 64ddf6fb0318d647831ad76d9fe4ffd25d5246305567223337d38bc83ef1d40e
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 KB
Contents
require 'active_resource' module RedmineRest module Models # # Model of issue relations # class Relation < ActiveResource::Base TYPES = %w(relates duplicates duplicated blocks blocked precedes follows copied_to copied_from).freeze self.format = :xml validate :validate_relation_type, :validate_issue_id, :validate_issue_to_id def self.set_prefix self.prefix = '/issues/:issue_id' end set_prefix def self.find(what, options = {}) if what == :all super else self.prefix = '/' result = super set_prefix result end end private def validate_relation_type errors.add(:relation_type, 'Wrong relation type') unless relation_type? && TYPES.include?(relation_type) end def validate_issue_id errors.add(:issue_id, 'Issue ID required') unless issue_id? end def validate_issue_to_id errors.add(:issue_to_id, 'Issue ID required') unless issue_to_id? end end end end
Version data entries
5 entries across 5 versions & 1 rubygems