Sha256: a12cf432c072d08e830939fb4d0ff70d914a25fc2e500ca58e0c3d03df357e6f

Contents?: true

Size: 496 Bytes

Versions: 11

Compression:

Stored size: 496 Bytes

Contents

module Restly::Collection::ErrorHandling
  extend ActiveSupport::Concern

  def response_has_errors?(response=self.response)
    @response.status >= 400 ||
      (parsed_response(response).is_a?(Hash) &&
        (parsed_response(response)[:errors] || parsed_response(response)[:error]))
  end

  def set_errors_from_response(response = self.response)
    if (error = parsed_response(response)[:errors] || parsed_response(response)[:error])
      @errors << error
    end
    replace []
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
restly-0.0.1.beta.10 lib/restly/collection/error_handling.rb
restly-0.0.1.beta.9 lib/restly/collection/error_handling.rb
restly-0.0.1.beta.6 lib/restly/collection/error_handling.rb
restly-0.0.1.beta.5 lib/restly/collection/error_handling.rb
restly-0.0.1.beta.4 lib/restly/collection/error_handling.rb
restly-0.0.1.beta.3 lib/restly/collection/error_handling.rb
restly-0.0.1.beta.2 lib/restly/collection/error_handling.rb
restly-0.0.1.beta.1 lib/restly/collection/error_handling.rb
restly-0.0.1.alpha.22 lib/restly/collection/error_handling.rb
restly-0.0.1.alpha.19 lib/restly/collection/error_handling.rb
restly-0.0.1.alpha.18 lib/restly/collection/error_handling.rb