Sha256: f5dcfd2ea77b092cd5c0cc2e9b7a7e04d8fe9224ccd3e1ec1060d47c5dca3cc6

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

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

      attr_reader :json

      json_parse :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
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mercy-1.3.0 lib/bidu/mercy/report.rb
bidu-mercy-1.3.0 lib/bidu/mercy/report.rb