Sha256: c9cd7b22ecb1c2805f41c41e74595d47d5b71fb2103edc28bdd8f48c8e2aa5c7

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 Bytes

Contents

module Bidu
  module House
    class Report
      include JsonParser
      require 'bidu/house/report/active_record'
      require 'bidu/house/report/error'
      require 'bidu/house/report/range'
      require 'bidu/house/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

1 entries across 1 versions & 1 rubygems

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