roust 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +9 -1
- data/lib/roust/ticket.rb +2 -0
- data/lib/roust/version.rb +1 -1
- data/spec/mocks/ticket-99-show.txt +19 -0
- data/spec/mocks/ticket-create.txt +4 -0
- data/spec/mocks/ticket-search-that-does-not-exist.txt +3 -0
- data/spec/roust/ticket_spec.rb +38 -0
- data/spec/spec_helper.rb +3 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c102bb99b7d456ca07bf00247fbaa73bb59d478f
|
4
|
+
data.tar.gz: b27166baced2282c39f4abb164852e865815c88c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e305f5117a6a07a034699cf5644362c05815bc7d903041ea4325cc652164d12101348f876dbf4b5970712880244fe0f021ba822393f450bc53f8ec392d54bffb
|
7
|
+
data.tar.gz: b646a7d5c1fcd8e5614292f575964a2b89d16204e6ac38a54a7eb207bb6cb364cdbc437662aec048c25adca1ce4e95560336927391b8312d9bd0c3f6d7b4451e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -44,7 +44,8 @@ rt = Roust.new(credentials)
|
|
44
44
|
rt.authenticated? # => true
|
45
45
|
|
46
46
|
# Query RT
|
47
|
-
rt.search(:query => "id = 1 or id = 2") # => [
|
47
|
+
rt.search(:query => "id = 1 or id = 2") # => [ {"id"=>"1", "Subject"=>"tell Nestor password for ROAR website"}, {"id"=>"2", "Subject"=>"Blum"} ]
|
48
|
+
rt.search(:query => "id = 1 or id = 2", :verbose => true) # => [ { "Subject"=>"Heavy packet loss", "id"=>"1", "Queue"=>"support", "Owner"=>"bob", "Creator"=>"alice", ... } ]
|
48
49
|
|
49
50
|
# Fetch ticket metadata
|
50
51
|
rt.show("1") # => { {"cc"=>["dan@us.example", "dave@them.example"], "owner"=>"bob", "creator"=>"alice", "status"=>"open", … }
|
@@ -53,6 +54,13 @@ rt.show("1") # => { {"cc"=>["dan@us.example", "dave@them.example"], "owner"=>"bo
|
|
53
54
|
rt.history("1", :format => "short") # => [["1", "Ticket created by alice"], ["2", "Status changed from 'open' to 'resolved' by bob"]]
|
54
55
|
rt.history("1", :format => "long") # => [{"id"=>"1", "ticket"=>"1", "timetaken"=>"0", "type"=>"Create", "field"=>"", "oldvalue"=>"", "newvalue"=>"", "data"=>"", "description"=>"Ticket created by alice" }, … ]
|
55
56
|
|
57
|
+
# Create ticket
|
58
|
+
attrs = {
|
59
|
+
'Subject' => 'a test ticket',
|
60
|
+
'Queue' => 'sales'
|
61
|
+
}
|
62
|
+
rt.create(attrs) # => { 'Subject' => 'a test ticket', 'Queue' => 'sales', … }
|
63
|
+
|
56
64
|
# Fetch user details
|
57
65
|
rt.user("dan@us.example") # => {"id"=>"user/160000", "name"=>"dan", "password"=>"********", "emailaddress"=>"dan@us.example", "realname"=>"Dan Smith", "nickname"=>"dan", … }
|
58
66
|
|
data/lib/roust/ticket.rb
CHANGED
data/lib/roust/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
RT/3.4.6 200 Ok
|
2
|
+
|
3
|
+
id: ticket/99
|
4
|
+
Queue: sales
|
5
|
+
Subject: test ticket
|
6
|
+
Status: new
|
7
|
+
Priority: 101
|
8
|
+
InitialPriority: 101
|
9
|
+
FinalPriority: 100
|
10
|
+
Created: Tue Dec 11 07:59:31 2012
|
11
|
+
Starts: Not set
|
12
|
+
Started: Not set
|
13
|
+
Due: Wed Dec 12 20:58:48 2012
|
14
|
+
Resolved: Wed Jan 16 16:33:15 2013
|
15
|
+
Told: Mon Jan 07 15:27:09 2013
|
16
|
+
LastUpdated: Wed Nov 06 09:33:43 2013
|
17
|
+
TimeEstimated: 0
|
18
|
+
TimeWorked: 12 hours
|
19
|
+
TimeLeft: 0
|
data/spec/roust/ticket_spec.rb
CHANGED
@@ -17,6 +17,13 @@ describe Roust do
|
|
17
17
|
:body => mocks_path.join('ticket-search-1-or-2-long.txt').read,
|
18
18
|
:headers => {})
|
19
19
|
|
20
|
+
%w(s l).each do |format|
|
21
|
+
stub_request(:get, "http://rt.example.org/REST/1.0/search/ticket?format=#{format}&orderby=%2Bid&query=subject%20=%20%22a%20ticket%20that%20does%20not%20exist%22")
|
22
|
+
.to_return(:status => 200,
|
23
|
+
:body => mocks_path.join('ticket-search-that-does-not-exist.txt').read,
|
24
|
+
:headers => {})
|
25
|
+
end
|
26
|
+
|
20
27
|
stub_request(:get, 'http://rt.example.org/REST/1.0/ticket/1/history?format=s')
|
21
28
|
.to_return(:status => 200,
|
22
29
|
:body => mocks_path.join('ticket-1-history-short.txt').read,
|
@@ -32,6 +39,17 @@ describe Roust do
|
|
32
39
|
:body => mocks_path.join('ticket-3-links.txt').read,
|
33
40
|
:headers => {})
|
34
41
|
|
42
|
+
stub_request(:post, "http://rt.example.org/REST/1.0/ticket/new")
|
43
|
+
.with(:body => "content=id%3A%20ticket%2Fnew%0ASubject%3A%20test%20ticket%0AQueue%3A%20sales")
|
44
|
+
.to_return(:status => 200,
|
45
|
+
:body => mocks_path.join('ticket-create.txt').read,
|
46
|
+
:headers => {})
|
47
|
+
|
48
|
+
stub_request(:get, 'http://rt.example.org/REST/1.0/ticket/99/show')
|
49
|
+
.to_return(:status => 200,
|
50
|
+
:body => mocks_path.join('ticket-99-show.txt').read,
|
51
|
+
:headers => {})
|
52
|
+
|
35
53
|
@rt = Roust.new(credentials)
|
36
54
|
expect(@rt.authenticated?).to eq(true)
|
37
55
|
end
|
@@ -45,6 +63,14 @@ describe Roust do
|
|
45
63
|
end
|
46
64
|
end
|
47
65
|
|
66
|
+
it 'can list no tickets when there are no search results' do
|
67
|
+
results = @rt.search(:query => 'subject = "a ticket that does not exist"')
|
68
|
+
expect(results.size).to eq(0)
|
69
|
+
|
70
|
+
results = @rt.search(:query => 'subject = "a ticket that does not exist"', :verbose => true)
|
71
|
+
expect(results.size).to eq(0)
|
72
|
+
end
|
73
|
+
|
48
74
|
it 'can verbosely list tickets matching a query' do
|
49
75
|
results = @rt.search(:query => 'id = 1 or id = 2', :verbose => true)
|
50
76
|
expect(results.size).to eq(2)
|
@@ -115,5 +141,17 @@ describe Roust do
|
|
115
141
|
expect(links[key]).to_not be_empty
|
116
142
|
end
|
117
143
|
end
|
144
|
+
|
145
|
+
it 'can create tickets' do
|
146
|
+
attrs = {
|
147
|
+
'Subject' => 'test ticket',
|
148
|
+
'Queue' => 'sales',
|
149
|
+
}
|
150
|
+
ticket = @rt.ticket_create(attrs)
|
151
|
+
|
152
|
+
attrs.each do |k, v|
|
153
|
+
expect(ticket[k]).to eq(v)
|
154
|
+
end
|
155
|
+
end
|
118
156
|
end
|
119
157
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -35,7 +35,9 @@ RSpec.shared_context 'credentials' do
|
|
35
35
|
'user' => 'admin',
|
36
36
|
'pass' => 'password'
|
37
37
|
})
|
38
|
-
.to_return(:status => 200,
|
38
|
+
.to_return(:status => 200,
|
39
|
+
:body => mocks_path.join('ticket-create.txt').read,
|
40
|
+
:headers => {})
|
39
41
|
|
40
42
|
stub_request(:get, 'http://rt.example.org/REST/1.0/ticket/1/show')
|
41
43
|
.to_return(:status => 200,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roust
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.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-09-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
@@ -85,8 +85,11 @@ files:
|
|
85
85
|
- spec/mocks/ticket-1-show-unauthenticated.txt
|
86
86
|
- spec/mocks/ticket-1-show.txt
|
87
87
|
- spec/mocks/ticket-3-links.txt
|
88
|
+
- spec/mocks/ticket-99-show.txt
|
89
|
+
- spec/mocks/ticket-create.txt
|
88
90
|
- spec/mocks/ticket-search-1-or-2-long.txt
|
89
91
|
- spec/mocks/ticket-search-1-or-2.txt
|
92
|
+
- spec/mocks/ticket-search-that-does-not-exist.txt
|
90
93
|
- spec/mocks/user-dan@us.example-after-edit.txt
|
91
94
|
- spec/mocks/user-dan@us.example-edit.txt
|
92
95
|
- spec/mocks/user-dan@us.example.txt
|
@@ -130,8 +133,11 @@ test_files:
|
|
130
133
|
- spec/mocks/ticket-1-show-unauthenticated.txt
|
131
134
|
- spec/mocks/ticket-1-show.txt
|
132
135
|
- spec/mocks/ticket-3-links.txt
|
136
|
+
- spec/mocks/ticket-99-show.txt
|
137
|
+
- spec/mocks/ticket-create.txt
|
133
138
|
- spec/mocks/ticket-search-1-or-2-long.txt
|
134
139
|
- spec/mocks/ticket-search-1-or-2.txt
|
140
|
+
- spec/mocks/ticket-search-that-does-not-exist.txt
|
135
141
|
- spec/mocks/user-dan@us.example-after-edit.txt
|
136
142
|
- spec/mocks/user-dan@us.example-edit.txt
|
137
143
|
- spec/mocks/user-dan@us.example.txt
|