roust 1.5.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +5 -10
- data/README.md +0 -1
- data/lib/roust/ticket.rb +20 -5
- data/lib/roust/version.rb +1 -1
- data/spec/mocks/ticket-3-links.txt +19 -0
- data/spec/roust/ticket_spec.rb +17 -1
- metadata +20 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3febce0ccfa7b44ea209547f57d97b758f7e7190
|
4
|
+
data.tar.gz: d45a596e62bc4c1039428796539f7c5057f7ffd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae9c3cc4cdc0518d99d0c8a0a5e2947ff1267614c01f20c221218634a4fbafe2794c5933f97d79cf081bd55d0a52da1f023298a1dd201fc04246c55ab0088d72
|
7
|
+
data.tar.gz: 68025367e6042fecf660cdb6ade159895d5b1d12e1db9cdf685cfdee65b5602c0fba187b421f0eeb391557fb335e99c5f732a5fcb9a40ea06c4ca0052f430a42
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
roust (1.
|
4
|
+
roust (1.6.1)
|
5
5
|
activesupport (>= 4.1.0)
|
6
6
|
httparty (>= 0.13.1)
|
7
7
|
mail (>= 2.5.4)
|
@@ -25,19 +25,17 @@ GEM
|
|
25
25
|
httparty (0.13.1)
|
26
26
|
json (~> 1.8)
|
27
27
|
multi_xml (>= 0.5.2)
|
28
|
-
i18n (0.6.
|
28
|
+
i18n (0.6.11)
|
29
29
|
json (1.8.1)
|
30
|
-
mail (2.
|
31
|
-
mime-types (
|
32
|
-
treetop (~> 1.4.8)
|
30
|
+
mail (2.6.1)
|
31
|
+
mime-types (>= 1.16, < 3)
|
33
32
|
method_source (0.8.2)
|
34
|
-
mime-types (
|
33
|
+
mime-types (2.3)
|
35
34
|
minitest (5.3.3)
|
36
35
|
multi_xml (0.5.5)
|
37
36
|
parser (2.2.0.pre.3)
|
38
37
|
ast (>= 1.1, < 3.0)
|
39
38
|
slop (~> 3.4, >= 3.4.5)
|
40
|
-
polyglot (0.3.4)
|
41
39
|
powerpack (0.0.9)
|
42
40
|
pry (0.9.12.2)
|
43
41
|
coderay (~> 1.0.5)
|
@@ -67,9 +65,6 @@ GEM
|
|
67
65
|
safe_yaml (0.9.7)
|
68
66
|
slop (3.5.0)
|
69
67
|
thread_safe (0.3.3)
|
70
|
-
treetop (1.4.15)
|
71
|
-
polyglot
|
72
|
-
polyglot (>= 0.3.1)
|
73
68
|
tzinfo (1.1.0)
|
74
69
|
thread_safe (~> 0.1)
|
75
70
|
webmock (1.17.1)
|
data/README.md
CHANGED
data/lib/roust/ticket.rb
CHANGED
@@ -113,14 +113,16 @@ class Roust
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
def ticket_search(
|
116
|
+
def ticket_search(attrs)
|
117
117
|
params = {
|
118
|
-
:query => query,
|
119
118
|
:format => 's',
|
120
119
|
:orderby => '+id'
|
121
|
-
}
|
120
|
+
}.merge(attrs)
|
121
|
+
|
122
|
+
# FIXME(auxesis): query should be an actual method argument
|
123
|
+
raise ArgumentError, ":query not specified" unless params[:query]
|
124
|
+
|
122
125
|
response = self.class.get('/search/ticket', :query => params)
|
123
|
-
# FIXME(auxesis) use explode_response here
|
124
126
|
|
125
127
|
body, _ = explode_response(response)
|
126
128
|
body.split("\n").map do |t|
|
@@ -153,7 +155,20 @@ class Roust
|
|
153
155
|
end
|
154
156
|
end
|
155
157
|
|
156
|
-
|
158
|
+
def ticket_links(id)
|
159
|
+
response = self.class.get("/ticket/#{id}/links")
|
160
|
+
body, _ = explode_response(response)
|
161
|
+
|
162
|
+
hash = body_to_hash(body)
|
163
|
+
id = hash.delete('id').split('/')[1]
|
164
|
+
cleaned_hash = hash.map do |k, v|
|
165
|
+
ids = v.split(/\s*,\s*/).map {|url| url.split('/').last }
|
166
|
+
[ k, ids ]
|
167
|
+
end
|
168
|
+
|
169
|
+
Hash[cleaned_hash].merge('id' => id)
|
170
|
+
end
|
171
|
+
|
157
172
|
# TODO(auxesis): add method for updating ticket links
|
158
173
|
# TODO(auxesis): add method for listing ticket attachments
|
159
174
|
# TODO(auxesis): add method for getting a ticket attachment
|
data/lib/roust/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
RT/3.4.6 200 Ok
|
2
|
+
|
3
|
+
id: ticket/3/links
|
4
|
+
|
5
|
+
Members: fsck.com-rt://rt.example.org/ticket/100,
|
6
|
+
fsck.com-rt://rt.example.org/ticket/101,
|
7
|
+
fsck.com-rt://rt.example.org/ticket/102
|
8
|
+
|
9
|
+
MemberOf: fsck.com-rt://rt.example.org/ticket/99
|
10
|
+
|
11
|
+
RefersTo: fsck.com-rt://rt.example.org/ticket/150
|
12
|
+
|
13
|
+
ReferredToBy: fsck.com-rt://rt.example.org/ticket/151
|
14
|
+
|
15
|
+
DependsOn: fsck.com-rt://rt.example.org/ticket/50,
|
16
|
+
fsck.com-rt://rt.example.org/ticket/51,
|
17
|
+
fsck.com-rt://rt.example.org/ticket/52
|
18
|
+
|
19
|
+
DependedOnBy: fsck.com-rt://rt.example.org/ticket/49
|
data/spec/roust/ticket_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe Roust do
|
|
7
7
|
before do
|
8
8
|
mocks_path = Pathname.new(__FILE__).parent.parent.join('mocks')
|
9
9
|
|
10
|
-
stub_request(:get,
|
10
|
+
stub_request(:get, "http://rt.example.org/REST/1.0/search/ticket?format=s&orderby=%2Bid&query=id%20=%201%20or%20id%20=%202")
|
11
11
|
.to_return(:status => 200,
|
12
12
|
:body => mocks_path.join('ticket-search-1-or-2.txt').read,
|
13
13
|
:headers => {})
|
@@ -22,6 +22,11 @@ describe Roust do
|
|
22
22
|
:body => mocks_path.join('ticket-1-history-long.txt').read,
|
23
23
|
:headers => {})
|
24
24
|
|
25
|
+
stub_request(:get, "http://rt.example.org/REST/1.0/ticket/3/links")
|
26
|
+
.to_return(:status => 200,
|
27
|
+
:body => mocks_path.join('ticket-3-links.txt').read,
|
28
|
+
:headers => {})
|
29
|
+
|
25
30
|
@rt = Roust.new(credentials)
|
26
31
|
expect(@rt.authenticated?).to eq(true)
|
27
32
|
end
|
@@ -76,5 +81,16 @@ describe Roust do
|
|
76
81
|
end
|
77
82
|
end
|
78
83
|
end
|
84
|
+
|
85
|
+
it 'can list linked tickets on individual tickets' do
|
86
|
+
links = @rt.ticket_links('3')
|
87
|
+
|
88
|
+
expect(links['id']).to eq('3')
|
89
|
+
|
90
|
+
%w(Members MemberOf RefersTo ReferredToBy DependsOn DependedOnBy).each do |key|
|
91
|
+
expect(links).to include(key)
|
92
|
+
expect(links[key]).to_not be_empty
|
93
|
+
end
|
94
|
+
end
|
79
95
|
end
|
80
96
|
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roust
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lindsay Holmwood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.5.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.5.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: httparty
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.13.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.13.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 4.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.1.0
|
55
55
|
description: Roust is a Ruby API client to access Request Tracker's REST interface.
|
@@ -59,13 +59,13 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .rspec
|
64
|
-
- .rubocop.yml
|
65
|
-
- .rubocop_roust.yml
|
66
|
-
- .rubocop_todo.yml
|
67
|
-
- .ruby-version
|
68
|
-
- .travis.yml
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".rubocop_roust.yml"
|
66
|
+
- ".rubocop_todo.yml"
|
67
|
+
- ".ruby-version"
|
68
|
+
- ".travis.yml"
|
69
69
|
- Gemfile
|
70
70
|
- Gemfile.lock
|
71
71
|
- LICENSE
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- spec/mocks/ticket-1-history-short.txt
|
85
85
|
- spec/mocks/ticket-1-show-unauthenticated.txt
|
86
86
|
- spec/mocks/ticket-1-show.txt
|
87
|
+
- spec/mocks/ticket-3-links.txt
|
87
88
|
- spec/mocks/ticket-search-1-or-2.txt
|
88
89
|
- spec/mocks/user-dan@us.example-after-edit.txt
|
89
90
|
- spec/mocks/user-dan@us.example-edit.txt
|
@@ -106,17 +107,17 @@ require_paths:
|
|
106
107
|
- lib
|
107
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
109
|
requirements:
|
109
|
-
- -
|
110
|
+
- - ">="
|
110
111
|
- !ruby/object:Gem::Version
|
111
112
|
version: 1.9.2
|
112
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
114
|
requirements:
|
114
|
-
- -
|
115
|
+
- - ">="
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: '0'
|
117
118
|
requirements: []
|
118
119
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.2.2
|
120
121
|
signing_key:
|
121
122
|
specification_version: 4
|
122
123
|
summary: Ruby client for RT's REST API
|
@@ -127,6 +128,7 @@ test_files:
|
|
127
128
|
- spec/mocks/ticket-1-history-short.txt
|
128
129
|
- spec/mocks/ticket-1-show-unauthenticated.txt
|
129
130
|
- spec/mocks/ticket-1-show.txt
|
131
|
+
- spec/mocks/ticket-3-links.txt
|
130
132
|
- spec/mocks/ticket-search-1-or-2.txt
|
131
133
|
- spec/mocks/user-dan@us.example-after-edit.txt
|
132
134
|
- spec/mocks/user-dan@us.example-edit.txt
|