Class: Hoptoad::Error

Inherits:
Base
  • Object
show all
Defined in:
lib/hoptoad-api/client.rb

Class Method Summary collapse

Class Method Details

.find(*args) ⇒ Object

Raises:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/hoptoad-api/client.rb', line 70

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



88
89
90
91
92
# File 'lib/hoptoad-api/client.rb', line 88

def self.update(error, options)
  setup

  self.class.put(collection_path, options)
end