ruby-fogbugz 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 64d37b67d514c896ad7cfdaebb48fa9aa1d2e2f6
4
- data.tar.gz: 05130125f743953d50f313391a3bc7cb84e62d7c
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTNkNWU5YzM0YTQyYWU5MDFmYTE0MjU3MzI1NmExNTU1YzVkMzgxZA==
5
+ data.tar.gz: !binary |-
6
+ MmU5NGZjNDcyNmY2N2U3NjEwMGFlYjhlZTkxNDM0ZDFiOThhNzRlNg==
5
7
  SHA512:
6
- metadata.gz: 1be8bcc653dccffe85c2f1cd198110bb4130280dd455cecdcb7fb3ebd734c4da598a1ba1d6c10c3d094752af89a9ad23b7ad5a29e6867dc1becfc9788e6bf466
7
- data.tar.gz: 2c723bdd24dad1a02b81bbe79964b843b25b4a0c2eea57c5f493fc5303452a697f7a8079c45af54bb903d93eda75dac1c23387877e56c2b1f1caa21068d22d85
8
+ metadata.gz: !binary |-
9
+ MDk3MmY3OGRlNTA2NDliNDVjYzIzMDI5MzQ0NTg3NzNkMDRhMTFkNGM4NWFl
10
+ ZDg2NjBmM2RhM2UwZDMzYzU4ZmM4MDc0NjYxMWMwZGE3OTU3Nzg0ZjMyZDcy
11
+ ZWYwOWZiNTUzMWJkMzA3ZjJhNDhkY2JkOTMzYzIyZjFlNGM5MDg=
12
+ data.tar.gz: !binary |-
13
+ Mjc2OTEzZTg4MGYwMzg4YTg3NDk3YmNlOGUwOGEzZjNmNDc5NWNmM2M0Mjgy
14
+ ZWVkODMzNGRhMDBhZDFiNDY3M2VjY2NiY2UwZGVmZWZiMmNiYTJiODZhOWM1
15
+ NGFjMjIyZGMwNTdkZjI4YjMwNmE4YTM5NzlmNDBmNDE1M2ZlNTQ=
@@ -12,15 +12,18 @@ module Fogbugz
12
12
  end
13
13
 
14
14
  def request(action, options)
15
- # Convert the hash key/values to key=value&key2=value2 strings - CGI escaping along the way
16
- options_string = options[:params].map{ |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"}.join('&')
17
-
18
- url_string = "#{@root_url}/api.asp?cmd=#{action}&#{options_string}"
19
- url = URI.parse(url_string)
20
-
21
- request = Net::HTTP::Get.new(url_string, {"Content-Type"=>"text/xml"})
22
-
23
- http = Net::HTTP.new(url.host, url.port)
15
+ uri = URI("#{@root_url}/api.asp")
16
+
17
+ params = {
18
+ 'cmd' => action
19
+ }
20
+ params.merge!(options[:params])
21
+
22
+ # build up the form request
23
+ request = Net::HTTP::Post.new(uri.request_uri)
24
+ request.set_form_data(params)
25
+
26
+ http = Net::HTTP.new(uri.host, uri.port)
24
27
  http.use_ssl = @root_url.start_with? 'https'
25
28
 
26
29
  response = http.start {|http| http.request(request) }
@@ -1,3 +1,4 @@
1
+ require 'crack/util'
1
2
  require 'crack/xml'
2
3
 
3
4
  module Fogbugz
@@ -1,3 +1,3 @@
1
1
  module Fogbugz
2
- VERSION = "0.2.0"
2
+ VERSION = '0.2.1'
3
3
  end
@@ -12,4 +12,15 @@ class Cracker < FogTest
12
12
 
13
13
  assert_equal({"version" => "2"}, Fogbugz::Adapter::XML::Cracker.parse(XML))
14
14
  end
15
+
16
+ # Sometimes Fogbugz returns responses like this
17
+ test 'should return nil when the response is not valid' do
18
+ XML = <<-xml
19
+ <html><head><title>Object moved</title></head><body>
20
+ <h2>Object moved to <a href="http://example.fogbugz.com:84/internalError.asp?aspxerrorpath=/api.asp">here</a>.</h2>
21
+ </body></html>
22
+ xml
23
+
24
+ assert_equal(nil, Fogbugz::Adapter::XML::Cracker.parse(XML))
25
+ end
15
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-fogbugz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Hørup Eskildsen
@@ -15,70 +15,70 @@ dependencies:
15
15
  name: crack
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0.4'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0.4'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: '10.1'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: '10.1'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: minitest
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: '5.8'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: '5.8'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: mocha
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.1'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.1'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: codeclimate-test-reporter
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">="
74
+ - - ! '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - ! '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  description: A simple Ruby wrapper for the Fogbugz XML API
@@ -89,8 +89,8 @@ executables: []
89
89
  extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
- - ".gitignore"
93
- - ".travis.yml"
92
+ - .gitignore
93
+ - .travis.yml
94
94
  - Gemfile
95
95
  - README.md
96
96
  - Rakefile
@@ -113,17 +113,17 @@ require_paths:
113
113
  - lib
114
114
  required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ">="
116
+ - - ! '>='
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ">="
121
+ - - ! '>='
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project: ruby-fogbugz
126
- rubygems_version: 2.4.3
126
+ rubygems_version: 2.4.8
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Ruby wrapper for the Fogbugz API