Sha256: f9a7e2da5859b3caea6970f966b737bddf9a0db927dc18ca4f1b3058a82d0664

Contents?: true

Size: 476 Bytes

Versions: 3

Compression:

Stored size: 476 Bytes

Contents

module Workarea
  module Forter
    class Decision
      include ApplicationDocument

      embeds_many :responses, class_name: 'Workarea::Forter::Response'
      field :external_order_status, type: String, default: "PROCESSING"

      index(created_at: -1)

      # the last response returned from the forter service.
      def response
        return if responses.empty?
        responses.sort_by { |r| r.created_at.to_i }.last.decision_response
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-forter-1.2.4 app/models/workarea/forter/decision.rb
workarea-forter-1.2.3 app/models/workarea/forter/decision.rb
workarea-forter-1.2.2 app/models/workarea/forter/decision.rb