Class: GeneratorLabs::CertErrors
- Inherits:
-
Object
- Object
- GeneratorLabs::CertErrors
- Defined in:
- lib/generatorlabs/cert.rb
Overview
Certificate error retrieval
Instance Method Summary collapse
-
#get(params = {}) ⇒ Hash
Get certificate errors.
-
#get_all(params = {}) ⇒ Array
Get all errors with automatic pagination.
-
#initialize(handler) ⇒ CertErrors
constructor
A new instance of CertErrors.
Constructor Details
#initialize(handler) ⇒ CertErrors
Returns a new instance of CertErrors.
40 41 42 |
# File 'lib/generatorlabs/cert.rb', line 40 def initialize(handler) @handler = handler end |
Instance Method Details
#get(params = {}) ⇒ Hash
Get certificate errors
47 48 49 |
# File 'lib/generatorlabs/cert.rb', line 47 def get(params = {}) @handler.get('cert/errors', params) end |
#get_all(params = {}) ⇒ Array
Get all errors with automatic pagination
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/generatorlabs/cert.rb', line 54 def get_all(params = {}) all_items = [] page = 1 params = params.dup loop do params[:page] = page response = get(params) errors = response['errors'] || [] all_items.concat(errors) break unless page < (response['total_pages'] || 1) && !errors.empty? page += 1 end all_items end |