Class: Hoptoadr
- Inherits:
-
Object
- Object
- Hoptoadr
- Defined in:
- lib/hoptoadr.rb,
lib/hoptoadr/error.rb,
lib/hoptoadr/party.rb
Defined Under Namespace
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(account, auth_token) ⇒ Hoptoadr
constructor
A new instance of Hoptoadr.
- #paginate(page = 1) ⇒ Object
- #resolve_all_errors ⇒ Object
Constructor Details
Instance Method Details
#errors ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/hoptoadr.rb', line 17 def errors errors, page = [], 0 begin errors_on_page = paginate(page += 1) errors += errors_on_page end while errors_on_page.size == 30 # "Errors are paginated. You get 30 at a time." -- http://bit.ly/88rupg errors end |
#paginate(page = 1) ⇒ Object
12 13 14 15 |
# File 'lib/hoptoadr.rb', line 12 def paginate(page = 1) resp = Party.paginate page resp['nil_classes'] ? [] : resp['groups'].map {|e| Error.new(e) } end |
#resolve_all_errors ⇒ Object
26 27 28 29 30 |
# File 'lib/hoptoadr.rb', line 26 def resolve_all_errors errors.each do |e| e.resolve end end |