ruby-fogbugz 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +11 -0
- data/README.md +21 -10
- data/Rakefile +2 -0
- data/lib/ruby_fogbugz/interface.rb +2 -2
- data/lib/ruby_fogbugz/version.rb +1 -1
- data/ruby-fogbugz.gemspec +9 -7
- data/test/interface_test.rb +2 -7
- data/test/test_helper.rb +4 -1
- metadata +65 -29
- data/lib/ruby_fogbugz/adapters/http/typhoeus.rb +0 -23
- data/test/adapters/http/typhoeus_test.rb +0 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 64d37b67d514c896ad7cfdaebb48fa9aa1d2e2f6
|
4
|
+
data.tar.gz: 05130125f743953d50f313391a3bc7cb84e62d7c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1be8bcc653dccffe85c2f1cd198110bb4130280dd455cecdcb7fb3ebd734c4da598a1ba1d6c10c3d094752af89a9ad23b7ad5a29e6867dc1becfc9788e6bf466
|
7
|
+
data.tar.gz: 2c723bdd24dad1a02b81bbe79964b843b25b4a0c2eea57c5f493fc5303452a697f7a8079c45af54bb903d93eda75dac1c23387877e56c2b1f1caa21068d22d85
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,17 +1,28 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/firmafon/ruby-fogbugz.svg)](https://travis-ci.org/firmafon/ruby-fogbugz)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/firmafon/ruby-fogbugz/badges/gpa.svg)](https://codeclimate.com/github/firmafon/ruby-fogbugz)
|
3
|
+
[![Test Coverage](https://codeclimate.com/github/firmafon/ruby-fogbugz/badges/coverage.svg)](https://codeclimate.com/github/firmafon/ruby-fogbugz/coverage)
|
4
|
+
|
1
5
|
# ruby-fogbugz
|
2
6
|
|
3
7
|
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
8
|
|
5
|
-
|
9
|
+
## Installation
|
6
10
|
|
7
|
-
|
11
|
+
Add this line to your application's Gemfile:
|
8
12
|
|
9
13
|
```ruby
|
10
|
-
|
11
|
-
# => true
|
14
|
+
gem 'ruby-fogbugz'
|
12
15
|
```
|
13
16
|
|
14
|
-
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install ruby-fogbugz
|
24
|
+
|
25
|
+
## Usage
|
15
26
|
|
16
27
|
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
28
|
|
@@ -30,11 +41,11 @@ Returns your parsed XML:
|
|
30
41
|
"description"=>"All open cases assigned to Simon Eskildsen",
|
31
42
|
"cases" => {
|
32
43
|
"case"=> [
|
33
|
-
{"ixBug"=>"143", "sTitle"=>"Write ruby-fogbugz documentation",
|
44
|
+
{"ixBug"=>"143", "sTitle"=>"Write ruby-fogbugz documentation",
|
34
45
|
"sStatus"=>"active", "operations"=>"edit,assign,resolve,email,remind"},
|
35
|
-
{"ixBug"=>"146", "sTitle"=>"Tame a unicorn", "sStatus"=>"active",
|
46
|
+
{"ixBug"=>"146", "sTitle"=>"Tame a unicorn", "sStatus"=>"active",
|
36
47
|
"operations"=>"edit,assign,resolve,email,remind"},
|
37
|
-
{"ixBug"=>"152", "sTitle"=>"Hug a walrus", "sStatus"=>"active",
|
48
|
+
{"ixBug"=>"152", "sTitle"=>"Hug a walrus", "sStatus"=>"active",
|
38
49
|
"operations"=>"edit,assign,resolve,email,remind"},
|
39
50
|
], "count"=>"3"
|
40
51
|
}
|
@@ -70,11 +81,11 @@ puts "Token: #{fogbugz.token}"
|
|
70
81
|
Run the script, and initialize with the returned token:
|
71
82
|
|
72
83
|
```ruby
|
73
|
-
fogbugz = Fogbugz::Interface.new(:token => "some token to use from now on", :
|
84
|
+
fogbugz = Fogbugz::Interface.new(:token => "some token to use from now on", :uri => 'https://company.fogbugz.com') # remember to use https!
|
74
85
|
```
|
75
86
|
|
76
87
|
[fad]:http://fogbugz.stackexchange.com/fogbugz-xml-api
|
77
88
|
|
78
|
-
|
89
|
+
## License
|
79
90
|
|
80
91
|
`ruby-fogbugz` is released under the MIT license.
|
data/Rakefile
CHANGED
@@ -24,12 +24,12 @@ module Fogbugz
|
|
24
24
|
begin
|
25
25
|
@token ||= @xml.parse(response)["token"]
|
26
26
|
if @token.nil? || @token == ''
|
27
|
-
|
27
|
+
raise Fogbugz::AuthenticationException.new(@xml.parse(response)["error"])
|
28
28
|
end
|
29
29
|
rescue REXML::ParseException => e
|
30
30
|
# Probably an issue with the auth information
|
31
31
|
# p response
|
32
|
-
|
32
|
+
raise Fogbugz::AuthenticationException.new("Looks like there was an issue with authentication (to #{@options[:uri]} as #{@options[:email]}) - probably the host/url.")
|
33
33
|
end
|
34
34
|
@token
|
35
35
|
end
|
data/lib/ruby_fogbugz/version.rb
CHANGED
data/ruby-fogbugz.gemspec
CHANGED
@@ -6,19 +6,21 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "ruby-fogbugz"
|
7
7
|
s.version = Fogbugz::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = [
|
10
|
-
s.email = [
|
11
|
-
s.homepage =
|
9
|
+
s.authors = ['Simon Hørup Eskildsen', 'Jared Szechy']
|
10
|
+
s.email = ['sirup@sirupsen.com', 'jared.szechy@gmail.com']
|
11
|
+
s.homepage = 'https://github.com/firmafon/ruby-fogbugz'
|
12
12
|
s.summary = %q{Ruby wrapper for the Fogbugz API }
|
13
13
|
s.description = %q{A simple Ruby wrapper for the Fogbugz XML API}
|
14
|
+
s.license = 'MIT'
|
14
15
|
|
15
16
|
s.rubyforge_project = "ruby-fogbugz"
|
16
17
|
|
17
|
-
|
18
|
-
s.add_dependency('crack')
|
18
|
+
s.add_dependency 'crack', '~> 0.4'
|
19
19
|
|
20
|
-
s.add_development_dependency
|
21
|
-
s.add_development_dependency
|
20
|
+
s.add_development_dependency 'rake', '~> 10.1'
|
21
|
+
s.add_development_dependency 'minitest', '~> 5.8'
|
22
|
+
s.add_development_dependency 'mocha', '~> 1.1'
|
23
|
+
s.add_development_dependency 'codeclimate-test-reporter'
|
22
24
|
|
23
25
|
s.files = `git ls-files`.split("\n")
|
24
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/test/interface_test.rb
CHANGED
@@ -10,11 +10,6 @@ end
|
|
10
10
|
|
11
11
|
class BasicInterface < FogTest
|
12
12
|
def setup
|
13
|
-
Fogbugz.adapter[:http] = mock()
|
14
|
-
Fogbugz.adapter[:http].expects(:new)
|
15
|
-
|
16
|
-
Fogbugz.adapter[:xml] = mock()
|
17
|
-
|
18
13
|
@fogbugz = Fogbugz::Interface.new(CREDENTIALS)
|
19
14
|
end
|
20
15
|
|
@@ -25,11 +20,11 @@ end
|
|
25
20
|
|
26
21
|
class InterfaceRequests < FogTest
|
27
22
|
def setup
|
28
|
-
Fogbugz.adapter[:http]
|
23
|
+
#Fogbugz.adapter[:http] = mock()
|
24
|
+
#Fogbugz.adapter[:http].expects(:new)
|
29
25
|
end
|
30
26
|
|
31
27
|
test 'authentication should send correct parameters' do
|
32
|
-
|
33
28
|
fogbugz = Fogbugz::Interface.new(CREDENTIALS)
|
34
29
|
fogbugz.http.expects(:request).with(:logon,
|
35
30
|
:params => {
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
require 'codeclimate-test-reporter'
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
|
1
4
|
require 'rubygems'
|
2
5
|
gem 'minitest' # ensures you're using the gem, and not the built in MT
|
3
6
|
$: << File.expand_path(File.dirname(__FILE__) + "../lib")
|
4
7
|
|
5
8
|
require 'minitest/autorun'
|
6
9
|
require 'minitest/pride'
|
7
|
-
require 'mocha'
|
10
|
+
require 'mocha/mini_test'
|
8
11
|
|
9
12
|
require 'fogbugz'
|
10
13
|
|
metadata
CHANGED
@@ -1,97 +1,133 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-fogbugz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Simon Hørup Eskildsen
|
8
|
+
- Jared Szechy
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: crack
|
16
|
-
requirement:
|
17
|
-
none: false
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
|
-
- -
|
18
|
+
- - "~>"
|
20
19
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
20
|
+
version: '0.4'
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
version_requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.4'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.1'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.1'
|
25
42
|
- !ruby/object:Gem::Dependency
|
26
43
|
name: minitest
|
27
|
-
requirement:
|
28
|
-
none: false
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
29
45
|
requirements:
|
30
|
-
- -
|
46
|
+
- - "~>"
|
31
47
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
48
|
+
version: '5.8'
|
33
49
|
type: :development
|
34
50
|
prerelease: false
|
35
|
-
version_requirements:
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '5.8'
|
36
56
|
- !ruby/object:Gem::Dependency
|
37
57
|
name: mocha
|
38
|
-
requirement:
|
39
|
-
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.1'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
66
|
requirements:
|
41
|
-
- -
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.1'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: codeclimate-test-reporter
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
42
75
|
- !ruby/object:Gem::Version
|
43
76
|
version: '0'
|
44
77
|
type: :development
|
45
78
|
prerelease: false
|
46
|
-
version_requirements:
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
47
84
|
description: A simple Ruby wrapper for the Fogbugz XML API
|
48
85
|
email:
|
49
86
|
- sirup@sirupsen.com
|
87
|
+
- jared.szechy@gmail.com
|
50
88
|
executables: []
|
51
89
|
extensions: []
|
52
90
|
extra_rdoc_files: []
|
53
91
|
files:
|
54
|
-
- .gitignore
|
92
|
+
- ".gitignore"
|
93
|
+
- ".travis.yml"
|
55
94
|
- Gemfile
|
56
95
|
- README.md
|
57
96
|
- Rakefile
|
58
97
|
- lib/fogbugz.rb
|
59
98
|
- lib/ruby_fogbugz/adapters/http/net_http.rb
|
60
|
-
- lib/ruby_fogbugz/adapters/http/typhoeus.rb
|
61
99
|
- lib/ruby_fogbugz/adapters/xml/cracker.rb
|
62
100
|
- lib/ruby_fogbugz/interface.rb
|
63
101
|
- lib/ruby_fogbugz/version.rb
|
64
102
|
- ruby-fogbugz.gemspec
|
65
|
-
- test/adapters/http/typhoeus_test.rb
|
66
103
|
- test/adapters/xml/crack_test.rb
|
67
104
|
- test/interface_test.rb
|
68
105
|
- test/test_helper.rb
|
69
|
-
homepage:
|
70
|
-
licenses:
|
106
|
+
homepage: https://github.com/firmafon/ruby-fogbugz
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
71
110
|
post_install_message:
|
72
111
|
rdoc_options: []
|
73
112
|
require_paths:
|
74
113
|
- lib
|
75
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
115
|
requirements:
|
78
|
-
- -
|
116
|
+
- - ">="
|
79
117
|
- !ruby/object:Gem::Version
|
80
118
|
version: '0'
|
81
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
120
|
requirements:
|
84
|
-
- -
|
121
|
+
- - ">="
|
85
122
|
- !ruby/object:Gem::Version
|
86
123
|
version: '0'
|
87
124
|
requirements: []
|
88
125
|
rubyforge_project: ruby-fogbugz
|
89
|
-
rubygems_version:
|
126
|
+
rubygems_version: 2.4.3
|
90
127
|
signing_key:
|
91
|
-
specification_version:
|
128
|
+
specification_version: 4
|
92
129
|
summary: Ruby wrapper for the Fogbugz API
|
93
130
|
test_files:
|
94
|
-
- test/adapters/http/typhoeus_test.rb
|
95
131
|
- test/adapters/xml/crack_test.rb
|
96
132
|
- test/interface_test.rb
|
97
133
|
- test/test_helper.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'typhoeus'
|
2
|
-
|
3
|
-
module Fogbugz
|
4
|
-
module Adapter
|
5
|
-
module HTTP
|
6
|
-
class Typhoeuser
|
7
|
-
attr_accessor :uri, :requester
|
8
|
-
|
9
|
-
def initialize(options = {})
|
10
|
-
@uri = options[:uri]
|
11
|
-
@requester = Typhoeus::Request
|
12
|
-
end
|
13
|
-
|
14
|
-
def request(action, options)
|
15
|
-
params = {:cmd => action}.merge(options[:params])
|
16
|
-
query = @requester.get("#{uri}/api.asp",
|
17
|
-
:params => params)
|
18
|
-
query.body
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'ruby_fogbugz/adapters/http/typhoeus'
|
3
|
-
|
4
|
-
class Typhoeuser < FogTest
|
5
|
-
test '#request should order the params right' do
|
6
|
-
response = mock()
|
7
|
-
response.expects(:body)
|
8
|
-
|
9
|
-
t = Fogbugz::Adapter::HTTP::Typhoeuser.new(:uri => 'http://test.com')
|
10
|
-
t.requester.expects(:get).returns(response)
|
11
|
-
t.request(:action, :params => {:one => "two", :three => "four"})
|
12
|
-
end
|
13
|
-
end
|