class BriteVerifyApi::Clients::Base
Constants
- API_HOST
Public Instance Methods
get(url, options = {})
click to toggle source
# File lib/brite_verify_api/clients/base.rb, line 8 def get(url, options = {}) options[:apikey] = BriteVerifyApi.configuration.api_key begin response = self.class.get(url, query: options) data = JSON.parse response.body, symbolize_names: true case response.code when 200 return RecursiveOpenStruct.new(data) else raise BriteVerifyApi::Error, data[:errors][:user] end rescue Errno::ECONNREFUSED => e raise BriteVerifyApi::Error, e.message rescue HTTParty::Error => e raise BriteVerifyApi::Error, e.message rescue => e raise BriteVerifyApi::Error, e.message end end