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



56
57
58
59
# File 'lib/redmine_rest/models/issue.rb', line 56

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)



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

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

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

  super(what, options)
end

Instance Method Details

#tracker_idObject



33
34
35
# File 'lib/redmine_rest/models/issue.rb', line 33

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