ruby-fogbugz-0.2.1/ 0000755 0001756 0001757 00000000000 12620617703 013201 5 ustar pravi pravi ruby-fogbugz-0.2.1/ruby-fogbugz.gemspec 0000644 0001756 0001757 00000002115 12620617703 017167 0 ustar pravi pravi # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "ruby_fogbugz/version"
Gem::Specification.new do |s|
s.name = "ruby-fogbugz"
s.version = Fogbugz::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Simon Hørup Eskildsen', 'Jared Szechy']
s.email = ['sirup@sirupsen.com', 'jared.szechy@gmail.com']
s.homepage = 'https://github.com/firmafon/ruby-fogbugz'
s.summary = %q{Ruby wrapper for the Fogbugz API }
s.description = %q{A simple Ruby wrapper for the Fogbugz XML API}
s.license = 'MIT'
s.rubyforge_project = "ruby-fogbugz"
s.add_dependency 'crack', '~> 0.4'
s.add_development_dependency 'rake', '~> 10.1'
s.add_development_dependency 'minitest', '~> 5.8'
s.add_development_dependency 'mocha', '~> 1.1'
s.add_development_dependency 'codeclimate-test-reporter'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
end
ruby-fogbugz-0.2.1/.travis.yml 0000644 0001756 0001757 00000000277 12620617703 015320 0 ustar pravi pravi language: ruby
rvm:
- 2.0.0-p647
- 2.1.7
- 2.2.3
- jruby-9.0.0.0
sudo: false
addons:
code_climate:
repo_token: ef52b4659b14e65b70be219cf870eaffcef8ee9c260b767b26694e2c7f59e88c
ruby-fogbugz-0.2.1/README.md 0000644 0001756 0001757 00000006427 12620617703 014471 0 ustar pravi pravi [](https://travis-ci.org/firmafon/ruby-fogbugz)
[](https://codeclimate.com/github/firmafon/ruby-fogbugz)
[](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!
```
[fad]:http://fogbugz.stackexchange.com/fogbugz-xml-api
## License
`ruby-fogbugz` is released under the MIT license.
ruby-fogbugz-0.2.1/test/ 0000755 0001756 0001757 00000000000 12620617703 014160 5 ustar pravi pravi ruby-fogbugz-0.2.1/test/test_helper.rb 0000644 0001756 0001757 00000000743 12620617703 017027 0 ustar pravi pravi require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
require 'rubygems'
gem 'minitest' # ensures you're using the gem, and not the built in MT
$: << File.expand_path(File.dirname(__FILE__) + "../lib")
require 'minitest/autorun'
require 'minitest/pride'
require 'mocha/mini_test'
require 'fogbugz'
class FogTest < MiniTest::Unit::TestCase
def self.test(description, &block)
define_method("test_" + description.split.join('_').gsub(/\W/, ''), block)
end
end
ruby-fogbugz-0.2.1/test/adapters/ 0000755 0001756 0001757 00000000000 12620617703 015763 5 ustar pravi pravi ruby-fogbugz-0.2.1/test/adapters/xml/ 0000755 0001756 0001757 00000000000 12620617703 016563 5 ustar pravi pravi ruby-fogbugz-0.2.1/test/adapters/xml/crack_test.rb 0000644 0001756 0001757 00000001432 12620617703 021232 0 ustar pravi pravi require 'test_helper'
require 'ruby_fogbugz/adapters/xml/cracker'
class Cracker < FogTest
test 'should parse XML and get rid of the response namespace' do
XML = <<-xml