cfoundry 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cfoundry/baseclient.rb +4 -12
- data/lib/cfoundry/v2/base.rb +1 -1
- data/lib/cfoundry/version.rb +1 -1
- metadata +3 -3
data/lib/cfoundry/baseclient.rb
CHANGED
@@ -56,7 +56,7 @@ module CFoundry
|
|
56
56
|
when :json
|
57
57
|
payload = payload.to_json
|
58
58
|
when :form
|
59
|
-
payload = encode_params(payload
|
59
|
+
payload = encode_params(payload)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -126,17 +126,9 @@ module CFoundry
|
|
126
126
|
def encode_params(hash, escape = true)
|
127
127
|
hash.keys.map do |k|
|
128
128
|
v = hash[k]
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
v.to_json
|
133
|
-
elsif escape
|
134
|
-
URI.escape(v.to_s, /[^#{URI::PATTERN::UNRESERVED}]/)
|
135
|
-
else
|
136
|
-
v
|
137
|
-
end
|
138
|
-
|
139
|
-
"#{k}=#{value}"
|
129
|
+
v = v.to_json if v.is_a?(Hash)
|
130
|
+
v = URI.escape(v.to_s, /[^#{URI::PATTERN::UNRESERVED}]/) if escape
|
131
|
+
"#{k}=#{v}"
|
140
132
|
end.join("&")
|
141
133
|
end
|
142
134
|
|
data/lib/cfoundry/v2/base.rb
CHANGED
@@ -117,7 +117,7 @@ module CFoundry::V2
|
|
117
117
|
info = parse_json(response)
|
118
118
|
raise CFoundry::APIError.new(info[:code], info[:description])
|
119
119
|
|
120
|
-
when 401
|
120
|
+
when 401, 403
|
121
121
|
info = parse_json(response)
|
122
122
|
raise CFoundry::Denied.new(info[:code], info[:description])
|
123
123
|
|
data/lib/cfoundry/version.rb
CHANGED
metadata
CHANGED