lib/vmc/client.rb in vmc-0.3.7 vs lib/vmc/client.rb in vmc-0.3.8
- old
+ new
@@ -109,10 +109,15 @@
def app_info(name)
check_login_status
json_get("#{VMC::APPS_PATH}/#{name}")
end
+ def app_update_info(name)
+ check_login_status
+ json_get("#{VMC::APPS_PATH}/#{name}/update")
+ end
+
def app_stats(name)
check_login_status
stats_raw = json_get("#{VMC::APPS_PATH}/#{name}/stats")
stats = []
stats_raw.each_pair do |k, entry|
@@ -343,12 +348,16 @@
def request(method, path, content_type = nil, payload = nil, headers = {})
headers = headers.dup
headers['AUTHORIZATION'] = @auth_token if @auth_token
headers['PROXY-USER'] = @proxy if @proxy
- headers['Content-Type'] = content_type if content_type
+ if content_type
+ headers['Content-Type'] = content_type
+ headers['Accept'] = content_type
+ end
+
req = {
:method => method, :url => "#{@target}#{path}",
:payload => payload, :headers => headers
}
status, body, response_headers = perform_http_request(req)
@@ -412,10 +421,11 @@
end
rescue JSON::ParserError
if body.nil? || body.empty?
"Error (#{status}): No Response Received"
else
- "Error (JSON #{status}): #{truncate(body)}"
+ body_out = trace ? body : truncate(body)
+ "Error (JSON #{status}): #{body_out}"
end
end
def check_login_status
raise AuthError unless @user || logged_in?