Sha256: a6b9d7cfb29ae6842d1fcab77fee5ab151acb8ed758581635d10bb59dcce82bd

Contents?: true

Size: 1.44 KB

Versions: 15

Compression:

Stored size: 1.44 KB

Contents

module Neuron
  module Schema
    class Report
      include Common

      SCHEMA = self.new

      def index
        @@index ||=
        set_of(object_type("report",
          :id => id,
          :template => choice_of(Neuron::Client::Report::TEMPLATES),
          :state => choice_of(Neuron::Client::Report::STATES)
        ))
      end

      def create
        @@create ||=
        object_type("report",
          :template => choice_of(Neuron::Client::Report::TEMPLATES),
          :parameters => report_parameters
        )
      end

      def show
        @@show ||=
        object_type("report",
          :id => id,
          :template => choice_of(Neuron::Client::Report::TEMPLATES),
          :state => choice_of(Neuron::Client::Report::STATES),
          :parameters => report_parameters,
          :started_at =>  datetime(:type => %w(string null)),
          :finished_at => datetime(:type => %w(string null)),
          :accessed_at => datetime(:type => %w(string null)),
          :created_at =>  datetime,
          :updated_at =>  datetime
        )
      end

      private

      def report_parameters
        parameters({
          :start => datetime,
          :end => datetime
        }, {
          :patternProperties => {
            '^\\w{1,255}$' => {
              :type => "string",
              :required => true,
              :minLength => 1,
              :maxLength => 255
            }
          }
        })
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
neuron-client-0.6.0 lib/neuron-client/schema/report.rb
neuron-client-0.5.3 lib/neuron-client/schema/report.rb
neuron-client-0.5.2 lib/neuron-client/schema/report.rb
neuron-client-0.5.1 lib/neuron-client/schema/report.rb
neuron-client-0.5.0 lib/neuron-client/schema/report.rb
neuron-client-0.4.8 lib/neuron-client/schema/report.rb
neuron-client-0.4.7 lib/neuron-client/schema/report.rb
neuron-client-0.4.6 lib/neuron-client/schema/report.rb
neuron-client-0.4.5 lib/neuron-client/schema/report.rb
neuron-client-0.4.4 lib/neuron-client/schema/report.rb
neuron-client-0.4.3 lib/neuron-client/schema/report.rb
neuron-client-0.4.2 lib/neuron-client/schema/report.rb
neuron-client-0.4.1 lib/neuron-client/schema/report.rb
neuron-client-0.4.0 lib/neuron-client/schema/report.rb
neuron-client-0.3.0 lib/neuron-client/schema/report.rb