Exception: Pluggy::InvalidRequestError
- 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
-
#invalid_cursor? ⇒ Boolean
GET /v2/transactions rejects a malformed
aftercursor with a 400. -
#parameter_errors ⇒ Object
POST /items 400 declares
errors: ParameterValidationError[]in the schema but every example in the spec emitsdetailsinstead.
Methods inherited from Error
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.
76 77 78 |
# File 'lib/pluggy/errors.rb', line 76 def invalid_cursor? code_description == "invalidCursor" || .to_s.downcase.include?("cursor") end |
#parameter_errors ⇒ Object
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 |