module Vonage::Http
Public Instance Methods
get(action, params = {})
click to toggle source
# File lib/vonage/http.rb, line 4 def get action, params = {}, num_retries = 0 options = {query: params, headers: {'Cookie': @cookies.to_cookie_string}} check_response self.class.get(action, options) rescue Vonage::AuthenticationError => e handle_expired_cookies :get, action, params, num_retries, e rescue SocketError, Interrupt, EOFError, SystemCallError, Timeout::Error => e raise Vonage::NetError.new(e) end
Protected Instance Methods
check_response(http_response)
click to toggle source
# File lib/vonage/http.rb, line 31 def check_response http_response case http_response.code when 400 throw Vonage::InvalidPhoneNumber when 403 throw Vonage::AuthenticationError if http_response.include?("USER NOT LOGGED IN") throw Vonage::Error when (401..600) throw Vonage::Error("Status Code: #{http_response.code}") end http_response end