jira-ruby 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73c4e19bc5c82d26d320a378266855abc8244997
4
- data.tar.gz: 2fd1c376a41076726c10f28afd9e4c380b38b91f
3
+ metadata.gz: a91329011e2ccf157d07936d501a70beb8ce35e2
4
+ data.tar.gz: d1dbd212719b220640475549e59e78a5d861d048
5
5
  SHA512:
6
- metadata.gz: 4b150a3fc57ba754238ae9851d2dd1c0b8f190203cd3e195d88c4778381c261f8f8a5196200f8ec13382eca8821fa2e24cf0008c37bf9582d91efda165d0e162
7
- data.tar.gz: af41788a14386555867711bd12b40622f2b473f02362b6fec5268cd7a3a99a4b82de73cb873bc91954296140e001900fd5f561cb307baf6eb45926b25c1bb911
6
+ metadata.gz: c1eb6f1379630c0899d7ea4cc60ed8c2ddf1addef20ee8efc0d2a9d0d9881d5a746634e4e4774cab7fdbe9d13a8426b4530a2111dde82dedc8d1e308474b5437
7
+ data.tar.gz: 5a3f281268b3203d4cb7480b78523b65d2aa381d9b21c9f3882eb7f255d8dff59936bd752e50c5084463cdc76497049ed6e52bd163394a289f1c2efef95a6d14
data/example.rb CHANGED
@@ -58,7 +58,7 @@ pp issue
58
58
  #
59
59
  # # List issues by JQL query
60
60
  # # ------------------------
61
- # client.Issue.jql('PROJECT = "SAMPLEPROJECT"').each do |issue|
61
+ # client.Issue.jql('PROJECT = "SAMPLEPROJECT"', [comments, summary]).each do |issue|
62
62
  # puts "#{issue.id} - #{issue.fields['summary']}"
63
63
  # end
64
64
  #
@@ -51,7 +51,7 @@ end
51
51
  #
52
52
  # # List issues by JQL query
53
53
  # # ------------------------
54
- # client.Issue.jql('PROJECT = "SAMPLEPROJECT"').each do |issue|
54
+ # client.Issue.jql('PROJECT = "SAMPLEPROJECT"', [comments, summary]).each do |issue|
55
55
  # puts "#{issue.id} - #{issue.fields['summary']}"
56
56
  # end
57
57
  #
data/jira-ruby.gemspec CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.homepage = "http://www.sumoheavy.com"
10
10
  s.summary = %q{Ruby Gem for use with the Atlassian JIRA REST API}
11
11
  s.description = %q{API for JIRA}
12
+ s.licenses = ["OSL-3.0"]
12
13
 
13
14
  s.rubyforge_project = "jira-ruby"
14
15
 
@@ -17,14 +18,9 @@ Gem::Specification.new do |s|
17
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
19
  s.require_paths = ["lib"]
19
20
 
20
- # specify any dependencies here; for example:
21
- # s.add_development_dependency "rspec"
22
- # s.add_runtime_dependency "rest-client"
23
- s.add_runtime_dependency "oauth"
24
- s.add_development_dependency "oauth"
25
21
  s.add_development_dependency "railties"
22
+ s.add_runtime_dependency "oauth"
26
23
  s.add_runtime_dependency "activesupport"
27
- s.add_development_dependency "activesupport"
28
24
  s.add_development_dependency "webmock"
29
25
  s.add_development_dependency "rspec"
30
26
  s.add_development_dependency "rake"
data/lib/jira.rb CHANGED
@@ -23,6 +23,7 @@ require 'jira/resource/comment'
23
23
  require 'jira/resource/worklog'
24
24
  require 'jira/resource/issue'
25
25
  require 'jira/resource/filter'
26
+ require 'jira/resource/field'
26
27
 
27
28
  require 'jira/request_client'
28
29
  require 'jira/oauth_client'
data/lib/jira/base.rb CHANGED
@@ -332,7 +332,7 @@ module JIRA
332
332
  end
333
333
 
334
334
  # Fetches the attributes for the specified resource from JIRA unless
335
- # the resource is already expanded and the optional force reload flag
335
+ # the resource is already expanded and the optional force reload flag
336
336
  # is not set
337
337
  def fetch(reload = false, query_params = {})
338
338
  return if expanded? && !reload
data/lib/jira/client.rb CHANGED
@@ -5,7 +5,7 @@ module JIRA
5
5
 
6
6
  # This class is the main access point for all JIRA::Resource instances.
7
7
  #
8
- # The client must be initialized with an options hash containing
8
+ # The client must be initialized with an options hash containing
9
9
  # configuration options. The available options are:
10
10
  #
11
11
  # :site => 'http://localhost:2990',
@@ -28,7 +28,7 @@ module JIRA
28
28
  #
29
29
  # See the JIRA::Base class methods for all of the available methods on these accessor
30
30
  # objects.
31
-
31
+
32
32
  class Client
33
33
 
34
34
  extend Forwardable
@@ -121,6 +121,10 @@ module JIRA
121
121
  JIRA::Resource::TransitionFactory.new(self)
122
122
  end
123
123
 
124
+ def Field # :nodoc:
125
+ JIRA::Resource::FieldFactory.new(self)
126
+ end
127
+
124
128
  # HTTP methods without a body
125
129
  def delete(path, headers = {})
126
130
  request(:delete, path, nil, merge_default_headers(headers))
@@ -28,7 +28,7 @@ module JIRA
28
28
  end
29
29
 
30
30
  def http_conn(uri)
31
- if @options[:proxy_address]
31
+ if @options[:proxy_address]
32
32
  http_class = Net::HTTP::Proxy(@options[:proxy_address], @options[:proxy_port] ? @options[:proxy_port] : 80)
33
33
  else
34
34
  http_class = Net::HTTP
@@ -0,0 +1,10 @@
1
+ module JIRA
2
+ module Resource
3
+
4
+ class FieldFactory < JIRA::BaseFactory # :nodoc:
5
+ end
6
+
7
+ class Field < JIRA::Base ; end
8
+
9
+ end
10
+ end
@@ -44,8 +44,9 @@ module JIRA
44
44
  end
45
45
  end
46
46
 
47
- def self.jql(client, jql)
47
+ def self.jql(client, jql, fields = nil)
48
48
  url = client.options[:rest_base_path] + "/search?jql=" + CGI.escape(jql)
49
+ url += CGI.escape("&fields=#{fields.join(",")}") if fields
49
50
  response = client.get(url)
50
51
  json = parse_json(response.body)
51
52
  json['issues'].map do |issue|
data/lib/jira/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JIRA
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe JIRA::Resource::Field do
4
+
5
+ with_each_client do |site_url, client|
6
+ let(:client) { client }
7
+ let(:site_url) { site_url }
8
+
9
+
10
+ let(:key) { "1" }
11
+
12
+ let(:expected_attributes) do
13
+ {
14
+ "id"=>key,
15
+ "name"=>"Description",
16
+ "custom"=>false,
17
+ "orderable"=>true,
18
+ "navigable"=>true,
19
+ "searchable"=>true,
20
+ "clauseNames"=>["description"],
21
+ "schema"=> {
22
+ "type"=>"string",
23
+ "system"=>"description"
24
+ }
25
+ }
26
+ end
27
+
28
+ let(:expected_collection_length) { 2 }
29
+
30
+ it_should_behave_like "a resource"
31
+ it_should_behave_like "a resource with a collection GET endpoint"
32
+ it_should_behave_like "a resource with a singular GET endpoint"
33
+
34
+ end
35
+ end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe JIRA::Resource::Issue do
4
4
 
5
- let(:client) { double() }
5
+ let(:client) { double(options: {rest_base_path: '/jira/rest/api/2'}) }
6
6
 
7
7
  it "should find an issue by key or id" do
8
8
  response = double()
@@ -19,6 +19,30 @@ describe JIRA::Resource::Issue do
19
19
  issue_from_id.attrs.should == issue_from_key.attrs
20
20
  end
21
21
 
22
+ it "should search an issue with a jql query string" do
23
+ response = double()
24
+ issue = double()
25
+ response.stub(:body).and_return('{"issues": {"key":"foo"}}')
26
+ client.should_receive(:get).with('/jira/rest/api/2/search?jql=foo+bar').
27
+ and_return(response)
28
+ client.should_receive(:Issue).and_return(issue)
29
+ issue.should_receive(:build).with(["key", "foo"]).and_return('')
30
+
31
+ JIRA::Resource::Issue.jql(client,'foo bar').should == ['']
32
+ end
33
+
34
+ it "should search an issue with a jql query string and fields" do
35
+ response = double()
36
+ issue = double()
37
+ response.stub(:body).and_return('{"issues": {"key":"foo"}}')
38
+ client.should_receive(:get).with('/jira/rest/api/2/search?jql=foo+bar%26fields%3Dfoo%2Cbar').
39
+ and_return(response)
40
+ client.should_receive(:Issue).and_return(issue)
41
+ issue.should_receive(:build).with(["key", "foo"]).and_return('')
42
+
43
+ JIRA::Resource::Issue.jql(client,'foo bar',['foo','bar']).should == ['']
44
+ end
45
+
22
46
  it "provides direct accessors to the fields" do
23
47
  subject = JIRA::Resource::Issue.new(client, :attrs => {'fields' => {'foo' =>'bar'}})
24
48
  subject.should respond_to(:foo)
@@ -0,0 +1,32 @@
1
+ [
2
+ {
3
+ "id": "1",
4
+ "name": "Description",
5
+ "custom": false,
6
+ "orderable": true,
7
+ "navigable": true,
8
+ "searchable": true,
9
+ "clauseNames": [
10
+ "description"
11
+ ],
12
+ "schema": {
13
+ "type": "string",
14
+ "system": "description"
15
+ }
16
+ },
17
+ {
18
+ "id": "2",
19
+ "name": "Summary",
20
+ "custom": false,
21
+ "orderable": true,
22
+ "navigable": true,
23
+ "searchable": true,
24
+ "clauseNames": [
25
+ "summary"
26
+ ],
27
+ "schema": {
28
+ "type": "string",
29
+ "system": "summary"
30
+ }
31
+ }
32
+ ]
@@ -0,0 +1,15 @@
1
+ {
2
+ "id": "1",
3
+ "name": "Description",
4
+ "custom": false,
5
+ "orderable": true,
6
+ "navigable": true,
7
+ "searchable": true,
8
+ "clauseNames": [
9
+ "description"
10
+ ],
11
+ "schema": {
12
+ "type": "string",
13
+ "system": "description"
14
+ }
15
+ }
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jira-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - SUMO Heavy Industries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-12 00:00:00.000000000 Z
11
+ date: 2014-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: oauth
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: oauth
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: railties
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +25,7 @@ dependencies:
53
25
  - !ruby/object:Gem::Version
54
26
  version: '0'
55
27
  - !ruby/object:Gem::Dependency
56
- name: activesupport
28
+ name: oauth
57
29
  requirement: !ruby/object:Gem::Requirement
58
30
  requirements:
59
31
  - - '>='
@@ -73,7 +45,7 @@ dependencies:
73
45
  - - '>='
74
46
  - !ruby/object:Gem::Version
75
47
  version: '0'
76
- type: :development
48
+ type: :runtime
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
@@ -150,6 +122,7 @@ files:
150
122
  - lib/jira/resource/attachment.rb
151
123
  - lib/jira/resource/comment.rb
152
124
  - lib/jira/resource/component.rb
125
+ - lib/jira/resource/field.rb
153
126
  - lib/jira/resource/filter.rb
154
127
  - lib/jira/resource/issue.rb
155
128
  - lib/jira/resource/issuetype.rb
@@ -166,6 +139,7 @@ files:
166
139
  - spec/integration/attachment_spec.rb
167
140
  - spec/integration/comment_spec.rb
168
141
  - spec/integration/component_spec.rb
142
+ - spec/integration/field_spec.rb
169
143
  - spec/integration/issue_spec.rb
170
144
  - spec/integration/issuetype_spec.rb
171
145
  - spec/integration/priority_spec.rb
@@ -194,6 +168,8 @@ files:
194
168
  - spec/mock_responses/component/10000.invalid.put.json
195
169
  - spec/mock_responses/component/10000.json
196
170
  - spec/mock_responses/component/10000.put.json
171
+ - spec/mock_responses/field.json
172
+ - spec/mock_responses/field/1.json
197
173
  - spec/mock_responses/issue.json
198
174
  - spec/mock_responses/issue.post.json
199
175
  - spec/mock_responses/issue/10002.invalid.put.json
@@ -230,7 +206,8 @@ files:
230
206
  - spec/support/matchers/have_one.rb
231
207
  - spec/support/shared_examples/integration.rb
232
208
  homepage: http://www.sumoheavy.com
233
- licenses: []
209
+ licenses:
210
+ - OSL-3.0
234
211
  metadata: {}
235
212
  post_install_message:
236
213
  rdoc_options: []
@@ -248,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
225
  version: '0'
249
226
  requirements: []
250
227
  rubyforge_project: jira-ruby
251
- rubygems_version: 2.0.5
228
+ rubygems_version: 2.2.2
252
229
  signing_key:
253
230
  specification_version: 4
254
231
  summary: Ruby Gem for use with the Atlassian JIRA REST API
@@ -256,6 +233,7 @@ test_files:
256
233
  - spec/integration/attachment_spec.rb
257
234
  - spec/integration/comment_spec.rb
258
235
  - spec/integration/component_spec.rb
236
+ - spec/integration/field_spec.rb
259
237
  - spec/integration/issue_spec.rb
260
238
  - spec/integration/issuetype_spec.rb
261
239
  - spec/integration/priority_spec.rb
@@ -284,6 +262,8 @@ test_files:
284
262
  - spec/mock_responses/component/10000.invalid.put.json
285
263
  - spec/mock_responses/component/10000.json
286
264
  - spec/mock_responses/component/10000.put.json
265
+ - spec/mock_responses/field.json
266
+ - spec/mock_responses/field/1.json
287
267
  - spec/mock_responses/issue.json
288
268
  - spec/mock_responses/issue.post.json
289
269
  - spec/mock_responses/issue/10002.invalid.put.json