Class: ThreeScale::Core::ServiceError

Inherits:
APIClient::Resource show all
Defined in:
lib/3scale/core/service_error.rb

Class Method Summary collapse

Methods inherited from APIClient::Resource

#initialize

Methods included from APIClient::Operations

included

Methods included from APIClient::Support

included

Methods included from APIClient::Attributes

#attributes, #dirty?, included, #update_attributes

Constructor Details

This class inherits a constructor from ThreeScale::Core::APIClient::Resource

Class Method Details

.delete_all(service_id) ⇒ Object



29
30
31
# File 'lib/3scale/core/service_error.rb', line 29

def self.delete_all(service_id)
  api_delete({}, uri: service_errors_uri(service_id))
end

.load_all(service_id, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/3scale/core/service_error.rb', line 13

def self.load_all(service_id, options={})
  result = api_do_get(options,
                      { uri: service_errors_uri(service_id),
                        prefix: '',
                        rprefix: :errors }) do |res|
    if res[:response].status == 400 &&
        res[:response_json][:error] == 'per_page needs to be > 0'
      raise InvalidPerPage.new
    end
    true
  end

  APIClient::Collection.new(result[:attributes].map { |attrs| new attrs },
                            result[:response_json][:count])
end