roust 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.ruby-version +1 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +55 -0
- data/LICENSE +14 -0
- data/README.md +103 -0
- data/Rakefile +37 -0
- data/examples/example.rb +15 -0
- data/lib/roust/rtxmlsrv.rb +271 -0
- data/lib/roust/version.rb +3 -0
- data/lib/roust.rb +856 -0
- data/roust.gemspec +29 -0
- data/spec/mocks/ticket-1-history-long.txt +1451 -0
- data/spec/mocks/ticket-1-history-short.txt +71 -0
- data/spec/mocks/ticket-1-show.txt +31 -0
- data/spec/mocks/ticket-search-1-or-2.txt +4 -0
- data/spec/mocks/user-dan@us.example.txt +21 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/ticket_spec.rb +125 -0
- metadata +141 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
RT/3.4.6 200 Ok
|
2
|
+
|
3
|
+
# 67/67 (/total)
|
4
|
+
|
5
|
+
1: Ticket created by eve
|
6
|
+
2: Status changed from 'open' to 'resolved' by eve
|
7
|
+
3: Comments added by eve
|
8
|
+
8342: Correspondence added by build@us.example
|
9
|
+
8343: Status changed from 'resolved' to 'open' by RT_System
|
10
|
+
8344: Correspondence added by build@us.example
|
11
|
+
8345: Status changed from 'open' to 'open' by RT_System
|
12
|
+
8489: Comments added by eve
|
13
|
+
8490: Status changed from 'open' to 'resolved' by eve
|
14
|
+
9044: Correspondence added by build@us.example
|
15
|
+
9045: Status changed from 'resolved' to 'open' by RT_System
|
16
|
+
9046: Correspondence added by build@us.example
|
17
|
+
9047: Status changed from 'open' to 'open' by RT_System
|
18
|
+
9048: Correspondence added by build@us.example
|
19
|
+
9049: Status changed from 'open' to 'open' by RT_System
|
20
|
+
9050: Correspondence added by build@us.example
|
21
|
+
9051: Status changed from 'open' to 'open' by RT_System
|
22
|
+
9052: Correspondence added by build@us.example
|
23
|
+
9053: Status changed from 'open' to 'open' by RT_System
|
24
|
+
9054: Correspondence added by build@us.example
|
25
|
+
9055: Status changed from 'open' to 'open' by RT_System
|
26
|
+
9196: Comments added by eve
|
27
|
+
9197: Given to john by eve
|
28
|
+
9205: Queue changed from dev-request to zz-spare9 by eve
|
29
|
+
9384: Ticket deleted by john
|
30
|
+
11905: Correspondence added by build@us.example
|
31
|
+
11906: Status changed from 'dead' to 'open' by RT_System
|
32
|
+
12424: Ticket deleted by john
|
33
|
+
831334: Status changed from 'deleted' to 'resolved' by ed
|
34
|
+
831335: Outgoing email recorded by RT_System
|
35
|
+
1194030: Member added by RT_System
|
36
|
+
1194050: Member added by RT_System
|
37
|
+
1194077: Member added by RT_System
|
38
|
+
1194097: Member added by RT_System
|
39
|
+
5241431: Status changed from 'resolved' to 'open' by dave
|
40
|
+
5241432: Outgoing email recorded by RT_System
|
41
|
+
5241434: Status changed from 'open' to 'resolved' by dave
|
42
|
+
5241435: Outgoing email recorded by RT_System
|
43
|
+
13820886: Member ticket #1318622 added by alice
|
44
|
+
13820896: Member ticket #1318622 deleted by alice
|
45
|
+
13820968: Member ticket #1318622 added by alice
|
46
|
+
13821080: Member ticket #1318622 deleted by alice
|
47
|
+
13821608: Member ticket #1318622 added by alice
|
48
|
+
13821626: Member ticket #1318622 deleted by alice
|
49
|
+
13825728: Member ticket #1318622 added by alice
|
50
|
+
13825732: Member ticket #1318622 deleted by alice
|
51
|
+
13825768: Member ticket #1318622 added by alice
|
52
|
+
13825804: Member ticket #1318622 deleted by alice
|
53
|
+
13825808: Member ticket #1318622 added by alice
|
54
|
+
13825848: Member ticket #1318622 deleted by alice
|
55
|
+
13825900: Member ticket #1318622 added by alice
|
56
|
+
13826056: Dependency by ticket #1318622 added by alice
|
57
|
+
13826060: Dependency by ticket #1318622 deleted by alice
|
58
|
+
13826084: Dependency by ticket #1318622 added by alice
|
59
|
+
13826236: Dependency by ticket #1318622 deleted by alice
|
60
|
+
13826564: Dependency by ticket #1318622 added by alice
|
61
|
+
13826586: Dependency by ticket #1318622 deleted by alice
|
62
|
+
13826698: Member ticket #1318622 deleted by alice
|
63
|
+
13827384: Member ticket #1318622 added by bob
|
64
|
+
13827490: Member ticket #1318622 deleted by alice
|
65
|
+
13827574: Member ticket #1318622 added by alice
|
66
|
+
13827764: Member ticket #1318622 deleted by alice
|
67
|
+
13829160: Member ticket #1318622 added by bob
|
68
|
+
13829214: Member ticket #1318622 deleted by bob
|
69
|
+
18722474: Member ticket #1784812 added by erin
|
70
|
+
18722620: Member ticket #1784812 added by erin
|
71
|
+
18722792: Member ticket #1784812 deleted by erin
|
@@ -0,0 +1,31 @@
|
|
1
|
+
RT/3.4.6 200 Ok
|
2
|
+
|
3
|
+
id: ticket/1
|
4
|
+
Queue: support
|
5
|
+
Owner: bob
|
6
|
+
Creator: alice
|
7
|
+
Subject: Heavy packet loss
|
8
|
+
Status: open
|
9
|
+
Priority: 101
|
10
|
+
InitialPriority: 101
|
11
|
+
FinalPriority: 100
|
12
|
+
|
13
|
+
Requestors: carol@them.example, chuck@them.example,
|
14
|
+
craig@them.example
|
15
|
+
|
16
|
+
Cc: dan@us.example, dave@them.example
|
17
|
+
|
18
|
+
AdminCc: erin@us.example, eve@us.example,
|
19
|
+
frank@us.example, oscar@us.example,
|
20
|
+
peggy@us.example, trent@us.example
|
21
|
+
|
22
|
+
Created: Tue Dec 11 07:59:31 2012
|
23
|
+
Starts: Not set
|
24
|
+
Started: Not set
|
25
|
+
Due: Wed Dec 12 20:58:48 2012
|
26
|
+
Resolved: Wed Jan 16 16:33:15 2013
|
27
|
+
Told: Mon Jan 07 15:27:09 2013
|
28
|
+
LastUpdated: Wed Nov 06 09:33:43 2013
|
29
|
+
TimeEstimated: 0
|
30
|
+
TimeWorked: 12 hours
|
31
|
+
TimeLeft: 0
|
@@ -0,0 +1,21 @@
|
|
1
|
+
RT/3.4.6 200 Ok
|
2
|
+
|
3
|
+
id: user/160000
|
4
|
+
Name: dan
|
5
|
+
Password: ********
|
6
|
+
EmailAddress: dan@us.example
|
7
|
+
RealName: Dan Smith
|
8
|
+
NickName: dan
|
9
|
+
Gecos: dan
|
10
|
+
Zip: quote
|
11
|
+
MobilePhone: 0400123456
|
12
|
+
PagerPhone: DESC
|
13
|
+
|
14
|
+
Signature: Dan Smith
|
15
|
+
Engineer
|
16
|
+
Example Org
|
17
|
+
tel: 1300 000 123
|
18
|
+
mob: 0400 123 456
|
19
|
+
fax: 02 9000 1234
|
20
|
+
|
21
|
+
Lang: en
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require 'pathname'
|
9
|
+
lib = Pathname.new(__FILE__).parent.parent.join('lib').to_s
|
10
|
+
$: << lib
|
11
|
+
require 'webmock/rspec'
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
# Use color in STDOUT
|
15
|
+
config.color_enabled = true
|
16
|
+
|
17
|
+
# Use color not only in STDOUT but also in pagers and files
|
18
|
+
config.tty = true
|
19
|
+
|
20
|
+
# Use the specified formatter
|
21
|
+
config.formatter = :documentation # :progress, :html, :textmate
|
22
|
+
|
23
|
+
# Rspec 3 forward compatibility
|
24
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
25
|
+
end
|
26
|
+
|
data/spec/ticket_spec.rb
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'roust'
|
3
|
+
|
4
|
+
describe "Roust" do
|
5
|
+
before do
|
6
|
+
@credentials = {
|
7
|
+
:server => 'http://rt.example.org',
|
8
|
+
:username => 'admin',
|
9
|
+
:password => 'password'
|
10
|
+
}
|
11
|
+
mocks_path = Pathname.new(__FILE__).parent.join('mocks')
|
12
|
+
|
13
|
+
stub_request(:post, "http://rt.example.org/REST/1.0/").
|
14
|
+
with(:body => {
|
15
|
+
"user"=>"admin",
|
16
|
+
"pass"=>"password",
|
17
|
+
}).
|
18
|
+
to_return(:status => 200, :body => "", :headers => {})
|
19
|
+
|
20
|
+
|
21
|
+
stub_request(:get, "http://rt.example.org/REST/1.0/ticket/1/show").
|
22
|
+
to_return(:status => 200,
|
23
|
+
:body => mocks_path.join('ticket-1-show.txt').read,
|
24
|
+
:headers => {})
|
25
|
+
|
26
|
+
stub_request(:get, "http://rt.example.org/REST/1.0/search/ticket/?format=s&orderby=&query=id%20=%201%20or%20id%20=%202").
|
27
|
+
to_return(:status => 200,
|
28
|
+
:body => mocks_path.join('ticket-search-1-or-2.txt').read,
|
29
|
+
:headers => {})
|
30
|
+
|
31
|
+
stub_request(:get, "http://rt.example.org/REST/1.0/ticket/1/history?format=s").
|
32
|
+
to_return(:status => 200,
|
33
|
+
:body => mocks_path.join('ticket-1-history-short.txt').read,
|
34
|
+
:headers => {})
|
35
|
+
|
36
|
+
stub_request(:get, "http://rt.example.org/REST/1.0/ticket/1/history?format=l").
|
37
|
+
to_return(:status => 200,
|
38
|
+
:body => mocks_path.join('ticket-1-history-long.txt').read,
|
39
|
+
:headers => {})
|
40
|
+
|
41
|
+
stub_request(:get, "http://rt.example.org/REST/1.0/user/dan@us.example").
|
42
|
+
to_return(:status => 200,
|
43
|
+
:body => mocks_path.join('user-dan@us.example.txt').read,
|
44
|
+
:headers => {})
|
45
|
+
end
|
46
|
+
|
47
|
+
it "authenticates on instantiation" do
|
48
|
+
rt = Roust.new(@credentials)
|
49
|
+
rt.authenticated?.should be_true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "can list tickets matching a query" do
|
53
|
+
rt = Roust.new(@credentials)
|
54
|
+
rt.authenticated?.should be_true
|
55
|
+
|
56
|
+
results = rt.list(:query => "id = 1 or id = 2")
|
57
|
+
results.size.should == 2
|
58
|
+
results.each do |result|
|
59
|
+
result.size.should == 2
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it "can fetch metadata on individual tickets" do
|
64
|
+
rt = Roust.new(@credentials)
|
65
|
+
rt.authenticated?.should be_true
|
66
|
+
|
67
|
+
ticket = rt.show("1")
|
68
|
+
ticket.should_not be_nil
|
69
|
+
|
70
|
+
attrs = %w(id subject queue) +
|
71
|
+
%w(requestors cc admincc owner creator) +
|
72
|
+
%w(resolved status) +
|
73
|
+
%w(starts started timeleft due timeworked timeestimated) +
|
74
|
+
%w(lastupdated created told) +
|
75
|
+
%w(priority finalpriority initialpriority)
|
76
|
+
|
77
|
+
attrs.each do |attr|
|
78
|
+
ticket[attr].should_not be_nil, "#{attr} key doesn't exist"
|
79
|
+
end
|
80
|
+
|
81
|
+
%w(requestors cc admincc).each do |field|
|
82
|
+
ticket[field].size.should > 1
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
it "can fetch transactions on individual tickets" do
|
87
|
+
rt = Roust.new(@credentials)
|
88
|
+
rt.authenticated?.should be_true
|
89
|
+
|
90
|
+
short = rt.history("1", :format => "short")
|
91
|
+
|
92
|
+
short.size.should > 1
|
93
|
+
short.each do |txn|
|
94
|
+
txn.size.should == 2
|
95
|
+
txn.first.should match(/^\d+$/)
|
96
|
+
txn.last.should match(/^\w.*\w$/)
|
97
|
+
end
|
98
|
+
|
99
|
+
#attrs = %w(ticket data oldvalue creator timetaken) +
|
100
|
+
# %w(id type field newvalue content description) +
|
101
|
+
# %w(attachments created)
|
102
|
+
attrs = %w(ticket data oldvalue timetaken) +
|
103
|
+
%w(id type field newvalue content description)
|
104
|
+
|
105
|
+
long = rt.history("1", :format => "long")
|
106
|
+
long.size.should > 0
|
107
|
+
long.each do |txn|
|
108
|
+
attrs.each do |attr|
|
109
|
+
txn[attr].should_not be_nil, "#{attr} key doesn't exist"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
it "can find user details" do
|
115
|
+
rt = Roust.new(@credentials)
|
116
|
+
rt.authenticated?.should be_true
|
117
|
+
|
118
|
+
attrs = %w(name realname gecos nickname emailaddress id lang password)
|
119
|
+
|
120
|
+
user = rt.user("dan@us.example")
|
121
|
+
attrs.each do |attr|
|
122
|
+
user[attr].should_not be_nil, "#{attr} key doesn't exist"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: roust
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lindsay Holmwood
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mail
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.5.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.5.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mime-types
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: archive-tar-minitar
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.5'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.2'
|
83
|
+
description: Roust is a Ruby API client that accesses the REST interface version 1.0
|
84
|
+
of a Request Tracker instance. See http://www.bestpractical.com/ for Request Tracker.
|
85
|
+
email:
|
86
|
+
- lindsay@holmwood.id.au
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- .ruby-version
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- examples/example.rb
|
99
|
+
- lib/roust.rb
|
100
|
+
- lib/roust/rtxmlsrv.rb
|
101
|
+
- lib/roust/version.rb
|
102
|
+
- roust.gemspec
|
103
|
+
- spec/mocks/ticket-1-history-long.txt
|
104
|
+
- spec/mocks/ticket-1-history-short.txt
|
105
|
+
- spec/mocks/ticket-1-show.txt
|
106
|
+
- spec/mocks/ticket-search-1-or-2.txt
|
107
|
+
- spec/mocks/user-dan@us.example.txt
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- spec/ticket_spec.rb
|
110
|
+
homepage: http://github.com/bulletproofnetworks/roust
|
111
|
+
licenses:
|
112
|
+
- Apache 2.0
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 1.9.2
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 2.0.3
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: Ruby client for RT's REST API
|
134
|
+
test_files:
|
135
|
+
- spec/mocks/ticket-1-history-long.txt
|
136
|
+
- spec/mocks/ticket-1-history-short.txt
|
137
|
+
- spec/mocks/ticket-1-show.txt
|
138
|
+
- spec/mocks/ticket-search-1-or-2.txt
|
139
|
+
- spec/mocks/user-dan@us.example.txt
|
140
|
+
- spec/spec_helper.rb
|
141
|
+
- spec/ticket_spec.rb
|