ruby-fogbugz-0.3.0/ 0000755 0000041 0000041 00000000000 13322513133 014160 5 ustar www-data www-data ruby-fogbugz-0.3.0/.travis.yml 0000644 0000041 0000041 00000000404 13322513133 016267 0 ustar www-data www-data language: ruby
rvm:
- 2.0.0-p648
- 2.1.10
- 2.2.6
- 2.3.3
- jruby-9.0.0.0
sudo: false
after_success:
- bundle exec codeclimate-test-reporter
addons:
code_climate:
repo_token: ef52b4659b14e65b70be219cf870eaffcef8ee9c260b767b26694e2c7f59e88c
ruby-fogbugz-0.3.0/.rspec 0000644 0000041 0000041 00000000036 13322513133 015274 0 ustar www-data www-data --color
--require spec_helper
ruby-fogbugz-0.3.0/README.md 0000644 0000041 0000041 00000010102 13322513133 015431 0 ustar www-data www-data [][gem]
[][travis]
[][gemnasium]
[][codeclimate]
[][coverage]
[gem]: https://rubygems.org/gems/ruby-fogbugz
[travis]: https://travis-ci.org/firmafon/ruby-fogbugz
[gemnasium]: https://gemnasium.com/firmafon/ruby-fogbugz
[codeclimate]: https://codeclimate.com/github/firmafon/ruby-fogbugz
[coverage]: https://codeclimate.com/github/firmafon/ruby-fogbugz/coverage
# ruby-fogbugz
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.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'ruby-fogbugz'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruby-fogbugz
## Usage
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:
cmd=search&ixAssignedTo=2&cols=sTitle,sStatus # list all cases associated to the user with ID of 2 in Fogbugz
In `ruby-fogbugz` that request would be:
```ruby
fogbugz.command(:search, :ixAssignedTo => 2, :cols => "sTitle,sStatus")
```
Returns your parsed XML:
```ruby
{
"description"=>"All open cases assigned to Simon Eskildsen",
"cases" => {
"case"=> [
{"ixBug"=>"143", "sTitle"=>"Write ruby-fogbugz documentation",
"sStatus"=>"active", "operations"=>"edit,assign,resolve,email,remind"},
{"ixBug"=>"146", "sTitle"=>"Tame a unicorn", "sStatus"=>"active",
"operations"=>"edit,assign,resolve,email,remind"},
{"ixBug"=>"152", "sTitle"=>"Hug a walrus", "sStatus"=>"active",
"operations"=>"edit,assign,resolve,email,remind"},
], "count"=>"3"
}
}
```
As you see, `ruby-fogbugz` is without magic and leaves most to the user.
`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].
All Fogbugz API requests require a token. Thus `#authenticate` must be called on the `ruby-fogbugz` instance before `#command`'s are sent:
```ruby
require 'fogbugz'
fogbugz = Fogbugz::Interface.new(:email => 'my@email.com', :password => 'seekrit', :uri => 'https://company.fogbugz.com') # remember to use https!
fogbugz.authenticate # token is now automatically attached to every future requests
p fogbugz.command(:listPeople)
```
`#authenticate` fetches a new token every time. To avoid the extra request,
obtain a token:
```ruby
require 'fogbugz'
fogbugz = Fogbugz::Interface.new(:email => 'my@email.com', :password => 'seekrit', :uri => 'https://company.fogbugz.com') # remember to use https!
fogbugz.authenticate # token is now automatically attached to every future requests
puts "Token: #{fogbugz.token}"
```
Run the script, and initialize with the returned token:
```ruby
fogbugz = Fogbugz::Interface.new(:token => "some token to use from now on", :uri => 'https://company.fogbugz.com') # remember to use https!
```
### Attachments
This library supports multipart file uploads to include attachments in your API request. A multipart request body is created (using the [multipart-post][mpp] gem) if `File1` is found in the command parameters. Files can be attached as follows:
```ruby
fogbugz.command(:new, sProject: "SomeProject", sArea: "someArea", sTitle: "Case title", File1: UploadIO.new(f, "text/plain", "someFile.rb"))
```
[fad]:http://fogbugz.stackexchange.com/fogbugz-xml-api
[mpp]:https://github.com/nicksieger/multipart-post
## License
`ruby-fogbugz` is released under the MIT license.
ruby-fogbugz-0.3.0/spec/ 0000755 0000041 0000041 00000000000 13322513133 015112 5 ustar www-data www-data ruby-fogbugz-0.3.0/spec/adapters/ 0000755 0000041 0000041 00000000000 13322513133 016715 5 ustar www-data www-data ruby-fogbugz-0.3.0/spec/adapters/xml/ 0000755 0000041 0000041 00000000000 13322513133 017515 5 ustar www-data www-data ruby-fogbugz-0.3.0/spec/adapters/xml/crack_spec.rb 0000644 0000041 0000041 00000001377 13322513133 022147 0 ustar www-data www-data RSpec.describe 'Cracker' do
context 'valid response xml' do
let(:xml) { %q(