Class: JIRA::Resource::Issue

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/resource/issue.rb

Constant Summary

Constants inherited from Base

Base::QUERY_PARAMS_FOR_SEARCH, Base::QUERY_PARAMS_FOR_SINGLE_FETCH

Instance Attribute Summary

Attributes inherited from Base

#attrs, #client, #deleted, #expanded

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

belongs_to, belongs_to_relationships, build, collection_attributes_are_nested, collection_path, #collection_path, #delete, endpoint_name, #fetch, find, #has_errors?, has_many, has_one, #id, #initialize, key_attribute, #key_value, nested_collections, #new_record?, parse_json, #path_component, populate, #save, #save!, #set_attrs, #set_attrs_from_response, singular_path, #to_json, #to_s, #to_sym, #url

Constructor Details

This class inherits a constructor from JIRA::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/jira/resource/issue.rb', line 70

def method_missing(method_name, *args, &block)
  if attrs.keys.include?('fields') && attrs['fields'].keys.include?(method_name.to_s)
    attrs['fields'][method_name.to_s]
  else
    super(method_name)
  end
end

Class Method Details

.all(client) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/jira/resource/issue.rb', line 36

def self.all(client)
  response = client.get(
    client.options[:rest_base_path] + "/search",
    :expand => 'transitions.fields'
  )
  json = parse_json(response.body)
  json['issues'].map do |issue|
    client.Issue.build(issue)
  end
end

.jql(client, jql, fields = nil, max_results = 9999999, start_at = 0) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/jira/resource/issue.rb', line 47

def self.jql(client, jql, fields = nil, max_results = 9999999, start_at = 0)
  result_issues = []
  result_count = 0

  while max_results > 0 and result_count % 1000 == 0
    new_issues = self.get_issues_by_jql(client, jql, fields, max_results, start_at)
    result_issues += new_issues
    result_count = new_issues.length
    max_results -= result_count
    start_at += result_count
  end

  result_issues
end

Instance Method Details

#respond_to?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
65
66
67
68
# File 'lib/jira/resource/issue.rb', line 62

def respond_to?(method_name)
  if attrs.keys.include?('fields') && attrs['fields'].keys.include?(method_name.to_s)
    true
  else
    super(method_name)
  end
end