Class: RedmineRest::Models::Issue

Inherits:
ActiveResource::Base show all
Defined in:
lib/redmine_rest/models/issue.rb

Overview

issue model

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ActiveResource::Base

find_by_id

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



54
55
56
57
# File 'lib/redmine_rest/models/issue.rb', line 54

def method_missing(method, *args)
  return super if block_given? || method.to_s.end_with?('?') || !args.empty?
  attributes[method]
end

Class Method Details

.find(what, options = {}) ⇒ Object

Adds journals, relations, children and watchers to request.

Be careful, even if issue has watchers, it won’t be loaded, because REST API can load them only after v2.3.0 (see Redmine docs)



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/redmine_rest/models/issue.rb', line 41

def self.find(what, options = {})
  options[:params] = {} unless options[:params]
  params = options[:params]

  if params[:include]
    params[:include] += ',journals,relations,children,watchers'
  else # doubling is not bad
    params[:include] = 'journals,relations,children,watchers'
  end

  super(what, options)
end

Instance Method Details

#tracker_idObject



31
32
33
# File 'lib/redmine_rest/models/issue.rb', line 31

def tracker_id
  attributes[:tracker_id] || tracker? && tracker.id
end