Exception: Pluggy::InvalidRequestError

Inherits:
Error
  • Object
show all
Defined in:
lib/pluggy/errors.rb

Defined Under Namespace

Classes: ParameterError

Instance Attribute Summary

Attributes inherited from Error

#api_message, #code, #code_description, #data, #http_body, #http_headers, #http_status, #json_body

Instance Method Summary collapse

Methods inherited from Error

#initialize, #to_s

Constructor Details

This class inherits a constructor from Pluggy::Error

Instance Method Details

#invalid_cursor?Boolean

GET /v2/transactions rejects a malformed after cursor with a 400.

Returns:

  • (Boolean)


76
77
78
# File 'lib/pluggy/errors.rb', line 76

def invalid_cursor?
  code_description == "invalidCursor" || message.to_s.downcase.include?("cursor")
end

#parameter_errorsObject

POST /items 400 declares errors: ParameterValidationError[] in the schema but every example in the spec emits details instead. Read both.



66
67
68
69
70
71
72
73
# File 'lib/pluggy/errors.rb', line 66

def parameter_errors
  raw = json_body&.values_at("errors", "details")&.compact&.first || []
  raw.filter_map do |e|
    next unless e.is_a?(Hash)

    ParameterError.new(e["parameter"], e["code"], e["message"])
  end
end