flytrap 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/flytrap.rb +7 -0
- data/lib/flytrap/client.rb +99 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZmVjNGQxNjgwNzBlMTg2ZGRlZjBmN2Q3NDNhMjlkMTRmYzk5ZDE2MA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTRjYzMyM2Q3Y2I4YjgxMzM3MDBlMmM1MDBlMmQyMzZiY2I5MDIyMQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OGFlZWM3MTA0NGFmNDhmNTc3ZDFmMWU1MTg3M2Y5NWQ5YzY2MTU4MWUwNTQ5
|
10
|
+
ZDkzYjhmMjdkY2VhZjcxZjQ0MjQ5MjI2YTNlMDgyMTllYTI0NzlmMWY1Mzdm
|
11
|
+
MzU3NDc4ZjRjNGU1NTEyOTg3MWM4YjI3MjAzNzJkNGViMjBjYmE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjAxY2MwZDE1NGI0Mjk0NmViYWE0Nzk4YjIxOWJkZGU2YWIwZTY3ZTk5NzU2
|
14
|
+
OGYzMjg1N2FhMjQyZTc2Mzk3OTQxYjAwNWNjOTg1M2Y1MTY4MmQ0MDQ3ZmM0
|
15
|
+
OWU3MjEwZGJmMDY3ZGM2ZTQ3YmQ4Nzc0NTVmNTkxODlkN2Q2N2I=
|
data/lib/flytrap.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
module Flytrap
|
2
|
+
class Client
|
3
|
+
def initialize(username, password, wsdl)
|
4
|
+
Savon.configure do |config|
|
5
|
+
config.log = false
|
6
|
+
end
|
7
|
+
|
8
|
+
@username = username
|
9
|
+
@password = password
|
10
|
+
@wsdl = wsdl
|
11
|
+
end
|
12
|
+
|
13
|
+
def mc_issue_exists?(issue_id)
|
14
|
+
client = Savon.client(@wsdl)
|
15
|
+
response = client.request(:mc_issue_exists) do
|
16
|
+
soap.body = {
|
17
|
+
:username => username,
|
18
|
+
:password => password,
|
19
|
+
:issue_id => issue_id
|
20
|
+
}
|
21
|
+
end
|
22
|
+
if response.success?
|
23
|
+
return response.body[:mc_issue_exists_response][:return]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def mc_issue_note_add(issue_id, note)
|
28
|
+
client = Savon.client(@wsdl)
|
29
|
+
response = client.request(:mc_issue_note_add) do
|
30
|
+
soap.body = {
|
31
|
+
:username => username,
|
32
|
+
:password => password,
|
33
|
+
:issue_id => issue_id,
|
34
|
+
:note => { text: note }
|
35
|
+
}
|
36
|
+
end
|
37
|
+
if response.success?
|
38
|
+
return note_id = response.body[:mc_issue_note_add_response][:return]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def mc_issue_add(project_id, project_name, category, summary, description)
|
43
|
+
client = Savon.client(@wsdl)
|
44
|
+
response = client.request(:mc_issue_add) do
|
45
|
+
soap.body = {
|
46
|
+
:username => username,
|
47
|
+
:password => password,
|
48
|
+
:issue => {
|
49
|
+
:summary => summary,
|
50
|
+
:project => { :id => project_id, :name => project_name },
|
51
|
+
:category => category,
|
52
|
+
:description => description
|
53
|
+
}
|
54
|
+
}
|
55
|
+
end
|
56
|
+
response
|
57
|
+
end
|
58
|
+
|
59
|
+
def mc_issue_get(issue_id)
|
60
|
+
client = Savon.client(@wsdl)
|
61
|
+
response = client.request(:mc_issue_get) do
|
62
|
+
soap.body = {
|
63
|
+
:username => username,
|
64
|
+
:password => password,
|
65
|
+
:issue_id => issue_id
|
66
|
+
}
|
67
|
+
end
|
68
|
+
if response.success?
|
69
|
+
return response.body[:mc_issue_get_response][:return]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def mc_issue_get_id_from_summary(summary)
|
74
|
+
client = Savon.client(@wsdl)
|
75
|
+
response = client.request(:mc_issue_get_id_from_summary) do
|
76
|
+
soap.body = {
|
77
|
+
:username => username,
|
78
|
+
:password => password,
|
79
|
+
:summary => { text: summary[0..127] }
|
80
|
+
}
|
81
|
+
end
|
82
|
+
if response.success?
|
83
|
+
return response.body[:mc_issue_get_id_from_summary_response][:return]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# We need these because Savon uses instance_eval for the request method
|
88
|
+
# which means that we do not have access to our MantisConnect::Client's
|
89
|
+
# instance variables within that block.
|
90
|
+
private
|
91
|
+
def username
|
92
|
+
@username
|
93
|
+
end
|
94
|
+
|
95
|
+
def password
|
96
|
+
@password
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flytrap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brenton Morris
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Ruby client for the MantisConnect SOAP API
|
14
|
+
email: brenton@tentaclon.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/flytrap.rb
|
20
|
+
- lib/flytrap/client.rb
|
21
|
+
homepage: http://rubygems.org/gems/flytrap
|
22
|
+
licenses:
|
23
|
+
- GPL-2
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.0.3
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Communicate with the MantisConnect SOAP API with Ruby.
|
45
|
+
test_files: []
|