Floppy-amee 0.4.22 → 0.4.23
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/amee/connection.rb +6 -2
- data/lib/amee/version.rb +1 -1
- metadata +2 -2
data/lib/amee/connection.rb
CHANGED
@@ -3,7 +3,7 @@ require 'net/http'
|
|
3
3
|
module AMEE
|
4
4
|
class Connection
|
5
5
|
|
6
|
-
def initialize(server, username = nil, password = nil, use_json_if_available = true, enable_caching = false)
|
6
|
+
def initialize(server, username = nil, password = nil, use_json_if_available = true, enable_caching = false, enable_debug = false)
|
7
7
|
@server = server
|
8
8
|
@username = username
|
9
9
|
@password = password
|
@@ -18,7 +18,7 @@ module AMEE
|
|
18
18
|
end
|
19
19
|
# Make connection to server
|
20
20
|
@http = Net::HTTP.new(@server)
|
21
|
-
|
21
|
+
@http.set_debug_output($stdout) if enable_debug
|
22
22
|
end
|
23
23
|
|
24
24
|
def valid?
|
@@ -104,6 +104,10 @@ module AMEE
|
|
104
104
|
(@use_json_if_available && defined?(JSON)) ? 'application/json' : 'application/xml'
|
105
105
|
end
|
106
106
|
|
107
|
+
def redirect?(response)
|
108
|
+
response.code == '301' || response.code == '302'
|
109
|
+
end
|
110
|
+
|
107
111
|
def response_ok?(response)
|
108
112
|
case response.code
|
109
113
|
when '200'
|
data/lib/amee/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Floppy-amee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-09 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|