ruby-fogbugz 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +61 -2
- data/lib/ruby_fogbugz/interface.rb +1 -1
- data/lib/ruby_fogbugz/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,5 +1,64 @@
|
|
1
1
|
# ruby-fogbugz
|
2
2
|
|
3
|
-
|
3
|
+
A very simple wrapper for the Fogbugz API. It won't give you fancy classes for everything, it'll simply aid you in sending the API requests, parsing the returned XML finally retuning you a Hash.
|
4
4
|
|
5
|
-
|
5
|
+
# Installation
|
6
|
+
|
7
|
+
gem install ruby-fogbugz
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
["mri-1.9,2", "mri-1.8.7", "rbx-1.2.4", "rbx-2.0.0", "jruby-1.6.2"].all? { |implementation| implementation.works? }
|
11
|
+
# => true
|
12
|
+
```
|
13
|
+
|
14
|
+
# Usage
|
15
|
+
|
16
|
+
The Fogbugz API works by sending HTTP GET parameters to the API where the GET parameter `cmd` invokes a Fogbugz method, e.g. `cmd=listProjects` to get a list of all projects, `cmd`s then accept further arguments, such as listing all cases assigned to a specific person:
|
17
|
+
|
18
|
+
cmd=search&ixAssignedTo=2&cols=sTitle,sStatus # list all cases associated to the user with ID of 2 in Fogbugz
|
19
|
+
|
20
|
+
In `ruby-fogbugz` that request would be:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
fogbugz.command(:search, :ixAssignedTo => 2, :cols => "sTitle,sStatus")
|
24
|
+
```
|
25
|
+
|
26
|
+
Returns your parsed XML:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
{
|
30
|
+
"description"=>"All open cases assigned to Simon Eskildsen",
|
31
|
+
"cases" => {
|
32
|
+
"case"=> [
|
33
|
+
{"ixBug"=>"143", "sTitle"=>"Write ruby-fogbugz documentation",
|
34
|
+
"sStatus"=>"active", "operations"=>"edit,assign,resolve,email,remind"},
|
35
|
+
{"ixBug"=>"146", "sTitle"=>"Tame a unicorn", "sStatus"=>"active",
|
36
|
+
"operations"=>"edit,assign,resolve,email,remind"},
|
37
|
+
{"ixBug"=>"152", "sTitle"=>"Hug a walrus", "sStatus"=>"active",
|
38
|
+
"operations"=>"edit,assign,resolve,email,remind"},
|
39
|
+
], "count"=>"3"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
```
|
43
|
+
|
44
|
+
As you see, `ruby-fogbugz` is without magic and leaves most to the user.
|
45
|
+
|
46
|
+
`cmd` is the first argument to `Fogbugz#command`, the second argument being a `Hash` of additional GET arguments to specify the request further. You can see available `cmd`'s and arguments at the [Fogbugz API documentation][fad].
|
47
|
+
|
48
|
+
All Fogbugz API requests require a token. Thus `#authenticate` must be called on the `ruby-fogbugz` instance before `#command`'s are sent:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require 'rubygems'
|
52
|
+
require 'fogbugz'
|
53
|
+
require 'pp'
|
54
|
+
|
55
|
+
fogbugz = Fogbugz::Interface.new(:email => 'my@email.com', :password => 'seekrit', :uri => 'https://company.fogbugz.com') # remember to use https!
|
56
|
+
fogbugz.authenticate # token is not automatically attached to every future requests
|
57
|
+
pp fogbugz.command(:listPeople)
|
58
|
+
```
|
59
|
+
|
60
|
+
[fad]:http://fogbugz.stackexchange.com/fogbugz-xml-api
|
61
|
+
|
62
|
+
# License
|
63
|
+
|
64
|
+
`ruby-fogbugz` is released under the MIT license.
|
@@ -8,7 +8,7 @@ module Fogbugz
|
|
8
8
|
def initialize(options = {})
|
9
9
|
@options = {}.merge(options)
|
10
10
|
|
11
|
-
raise InitializationError, "Must supply URI (e.g.
|
11
|
+
raise InitializationError, "Must supply URI (e.g. https://fogbugz.company.com)" unless options[:uri]
|
12
12
|
@http = Fogbugz.adapter[:http].new(:uri => options[:uri])
|
13
13
|
@xml = Fogbugz.adapter[:xml]
|
14
14
|
end
|
data/lib/ruby_fogbugz/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-fogbugz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Simon H\xC3\xB8rup Eskildsen"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-01 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|