bugzscout 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/bugzscout.rb +51 -49
  2. metadata +3 -3
data/lib/bugzscout.rb CHANGED
@@ -10,61 +10,63 @@ require 'rubygems'
10
10
  require 'httpclient'
11
11
  require 'uri'
12
12
 
13
- # This is the core class that does all of the heavy lifting.
14
- class BugzScout
15
- attr_accessor :url, :user, :project, :area, :title, :new, :body, :email
13
+ module FogBugz
14
+ # This is the core class that does all of the heavy lifting.
15
+ class BugzScout
16
+ attr_accessor :url, :user, :project, :area, :title, :new, :body, :email
16
17
 
17
- # provide BugzScout with the URL of your FogBugz instance, including the 'scoutsubmit.asp' entry point
18
- # example: https://styledbits.fogbugz.com/scoutsubmit.asp
19
- def initialize(url)
20
- self.url = url
21
- end
18
+ # provide BugzScout with the URL of your FogBugz instance, including the 'scoutsubmit.asp' entry point
19
+ # example: https://styledbits.fogbugz.com/scoutsubmit.asp
20
+ def initialize(url)
21
+ self.url = url
22
+ end
22
23
 
23
- # send the response to FogBugz
24
- # return true if all goes well
25
- # throw a BugzScoutError exception along with the error text if otherwise.
26
- def submit
27
- # ensure that the required fields are included
28
- validate
24
+ # send the response to FogBugz
25
+ # return true if all goes well
26
+ # throw a BugzScoutError exception along with the error text if otherwise.
27
+ def submit
28
+ # ensure that the required fields are included
29
+ validate
29
30
 
30
- body = {
31
- :ScoutUserName => self.user,
32
- :ScoutProject => self.project,
33
- :ScoutArea => self.area,
34
- :Description => self.title,
35
- :ForceNewBug => self.new,
36
- :Extra => self.body,
37
- :Email => self.email,
38
- :ScoutDefaultMessage => "",
39
- :FriendlyResponse => 0
40
- }
41
- client = HTTPClient.new
42
- response = client.post(url, body).content
31
+ body = {
32
+ :ScoutUserName => self.user,
33
+ :ScoutProject => self.project,
34
+ :ScoutArea => self.area,
35
+ :Description => self.title,
36
+ :ForceNewBug => self.new,
37
+ :Extra => self.body,
38
+ :Email => self.email,
39
+ :ScoutDefaultMessage => "",
40
+ :FriendlyResponse => 0
41
+ }
42
+ client = HTTPClient.new
43
+ response = client.post(url, body).content
43
44
 
44
- if response =~ /<Error>(.*)<\/Error>/
45
- # if we see an error response, we know that we fudged some of our input values to BugzScout
46
- # the error message should contain where we went wrong.
47
- # We raise the exception so the user can catch it and log if necessary. No one likes things that fail silently!
48
- raise(BugzScoutError, $1)
49
- else
50
- # we'll return 'true' for the sake of clarity
51
- return true
45
+ if response =~ /<Error>(.*)<\/Error>/
46
+ # if we see an error response, we know that we fudged some of our input values to BugzScout
47
+ # the error message should contain where we went wrong.
48
+ # We raise the exception so the user can catch it and log if necessary. No one likes things that fail silently!
49
+ raise(BugzScoutError, $1)
50
+ else
51
+ # we'll return 'true' for the sake of clarity
52
+ return true
53
+ end
52
54
  end
53
- end
54
55
 
55
- def validate
56
- raise(BugzScoutError, "You have to provide a user name") if !self.user
57
- raise(BugzScoutError, "You must provide a FogBugz project") if !self.project
58
- raise(BugzScoutError, "You have to provide an area") if !self.area
59
- end
56
+ def validate
57
+ raise(BugzScoutError, "You have to provide a user name") if !self.user
58
+ raise(BugzScoutError, "You must provide a FogBugz project") if !self.project
59
+ raise(BugzScoutError, "You have to provide an area") if !self.area
60
+ end
60
61
 
61
- def self.submit(url)
62
- scout = BugzScout.new(url)
63
- yield scout
64
- scout.submit
65
- end
62
+ def self.submit(url)
63
+ scout = BugzScout.new(url)
64
+ yield scout
65
+ scout.submit
66
+ end
66
67
 
67
- end
68
+ end
68
69
 
69
- # just a simple custom exception
70
- class BugzScoutError < RuntimeError ; end
70
+ # just a simple custom exception
71
+ class BugzScoutError < RuntimeError ; end
72
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugzscout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Gorsuch
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-06 00:00:00 -05:00
12
+ date: 2009-11-07 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - lib/bugzscout.rb
35
35
  has_rdoc: true
36
- homepage: http://github.com/mgorsuch/BugzScout
36
+ homepage: http://github.com/mgorsuch/bugzscout
37
37
  licenses: []
38
38
 
39
39
  post_install_message: