Sha256: 8258e38e71c4b3bf4e75a0aa8e8b4bfeda069e4f413f4bd0d48cb1c691e8e18f

Contents?: true

Size: 544 Bytes

Versions: 12

Compression:

Stored size: 544 Bytes

Contents

# frozen_string_literal: true

require 'active_support'

class DHS::Proxy

  module Problems
    extend ActiveSupport::Concern

    included do
      attr_writer :errors, :warnings
    end

    def initialize(data)
      super(data)
    end

    def errors
      response = (_raw.present? && _raw.is_a?(Hash) && _raw[:field_errors]) ? OpenStruct.new(body: _raw.to_json) : nil
      @errors ||= DHS::Problems::Errors.new(response, record)
    end

    def warnings
      @warnings ||= DHS::Problems::Warnings.new(_raw, record)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dhs-1.6.0 lib/dhs/concerns/proxy/problems.rb
dhs-1.5.0 lib/dhs/concerns/proxy/problems.rb
dhs-1.4.2 lib/dhs/concerns/proxy/problems.rb
dhs-1.4.1 lib/dhs/concerns/proxy/problems.rb
dhs-1.4.0 lib/dhs/concerns/proxy/problems.rb
dhs-1.3.0 lib/dhs/concerns/proxy/problems.rb
dhs-1.2.0 lib/dhs/concerns/proxy/problems.rb
dhs-1.1.0 lib/dhs/concerns/proxy/problems.rb
dhs-1.0.3 lib/dhs/concerns/proxy/problems.rb
dhs-1.0.2 lib/dhs/concerns/proxy/problems.rb
dhs-1.0.1 lib/dhs/concerns/proxy/problems.rb
dhs-1.0.0 lib/dhs/concerns/proxy/problems.rb