Class: Hoptoad::Error
Class Method Summary collapse
Class Method Details
.find(*args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/hoptoad-api/error.rb', line 4 def self.find(*args) setup results = case args.first when Fixnum find_individual(args) when :all find_all(args) else raise HoptoadError.new('Invalid argument') end raise HoptoadError.new('No results found.') if results.nil? raise HoptoadError.new(results.errors.error) if results.errors results.group || results.groups end |
.update(error, options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hoptoad-api/error.rb', line 22 def self.update(error, ) setup response = put(error_path(error), { :query => }) if response.code == 403 raise HoptoadError.new('SSL should be enabled - use Hoptoad.secure = true in configuration') end results = Hashie::Mash.new(response) raise HoptoadError.new(results.errors.error) if results.errors results.group end |