Sha256: 8940e8d42492276f887ff28bf57bb5d61832dd93f3a1fb96b0d16c3295ca05d6

Contents?: true

Size: 455 Bytes

Versions: 3

Compression:

Stored size: 455 Bytes

Contents

module Mollie
  class Exception < StandardError
  end

  class RequestError < Exception
    attr_accessor :status, :title, :detail, :field, :links

    def initialize(error)
      exception.status = error['status']
      exception.title  = error['title']
      exception.detail = error['detail']
      exception.field  = error['field']
      exception.links  = error['_links']
    end

    def to_s
      "#{status} #{title}: #{detail}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mollie-api-ruby-4.0.0.pre.alpha.2 lib/mollie/exception.rb
mollie-api-ruby-4.0.0 lib/mollie/exception.rb
mollie-api-ruby-4.0.0.pre.alpha.1 lib/mollie/exception.rb