lib/hoptoad-api/client.rb in hoptoad-api-2.0.0 vs lib/hoptoad-api/client.rb in hoptoad-api-2.0.1
- old
+ new
@@ -26,21 +26,12 @@
module Hoptoad
class Error
include HTTParty
format :xml
- # cattr_accessor :collection_path, :individual_collection_path
-
@@collection_path = '/errors.xml'
@@individual_collection_path = '/errors/'
-
- # def initialize
- # self.class.base_uri "http://#{account}.hoptoadapp.com"
- # self.class.default_params :auth_token => token
- #
- #
- # end
def self.collection_path
@@collection_path
end
@@ -56,12 +47,10 @@
when :all
find_all(args)
else
raise HoptoadError.new('Invalid argument')
end
-
- # puts results.inspect
raise HoptoadError.new('No results found.') if results.nil?
raise HoptoadError.new(results.errors.error) if results.errors
results.group || results.groups
@@ -86,10 +75,12 @@
end
def self.find_individual(args)
id = args.shift
options = args.extract_options!
- Hashie::Mash.new(get("#{@@individual_collection_path}#{id}.xml", { :query => options }))
+ hash = Hashie::Mash.new(response = get("#{@@individual_collection_path}#{id}.xml", { :query => options }))
+ raise HoptoadError.new('SSL should be enabled - use Hoptoad.secure = true in configuration') if response.code == 403
+ hash
end
end
end