Sha256: 15c2337e63ad405ef9c12805fda861aaef8ce840084172eac4c9d99cc1324bdf

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 Bytes

Contents

module Mercy
  class Report
    include Arstotzka
    require 'mercy/report/active_record'
    require 'mercy/report/error'
    require 'mercy/report/range'
    require 'mercy/report/multiple'
    ALLOWED_PARAMETERS = []
    DEFAULT_OPTION = {}

    attr_reader :json

    expose :id, case: :snake

    def initialize(options = {})
      @json = default_option.merge(options)
    end

    def status
      @status ||= error? ? :error : :ok
    end

    def error?
      raise 'Not implemented yet'
    end

    def as_json
      { status: status }
    end

    private

    def default_option
      self.class.default_options
    end

    def self.default_options
      return {} if self == Report
      self.superclass.default_options.merge(self::DEFAULT_OPTION)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mercy-1.6.0 lib/mercy/report.rb
mercy-1.5.0 lib/mercy/report.rb