Class: JIRA::Resource::Version

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/resource/version.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

Methods inherited from Base

belongs_to, belongs_to_relationships, build, collection_attributes_are_nested, collection_path, #collection_path, #delete, endpoint_name, #fetch, #has_errors?, has_many, has_one, #id, #initialize, key_attribute, #key_value, #method_missing, nested_collections, #new_record?, parse_json, #patched_url, #path_component, #respond_to?, #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 in the class JIRA::Base

Class Method Details

.all(client, options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jira/resource/version.rb', line 7

def self.all(client, options)
  path = path_base(client, options)

  response = client.get(path)
  json = parse_json(response.body)
  results = json['values']

  until json['isLast']
    params = { 'startAt' => (json['startAt'] + json['maxResults']).to_s }
    response = client.get(url_with_query_params(path, params))
    json = parse_json(response.body)
    results += json['values']
  end

  results.map do |version|
    client.Version.build(version)
  end
end

.find(client, options) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/jira/resource/version.rb', line 27

def self.find(client, options)
  path = path_base(client, options)
  query_params = {
    "query" => options[:query],
    "status" => options[:status],
    "orderBy" => options[:orderBy]
  }
  .compact


  response = client.get(url_with_query_params(path, query_params))
  json = parse_json(response.body)
  results = json['values']

  until json['isLast']
    params = { 'startAt' => (json['startAt'] + json['maxResults']).to_s }
    response = client.get(url_with_query_params(path, params))
    json = parse_json(response.body)
    results += json['values']
  end

  results.map do |version|
    client.Version.build(version)
  end
end