Sha256: acb2ae233fbc0275f6857b2e86dba4da1d488ae6ed1cf056a13823b297afcda8

Contents?: true

Size: 665 Bytes

Versions: 13

Compression:

Stored size: 665 Bytes

Contents

module SimpleService
  class Command

    include ServiceBase::InstanceMethods
    extend ServiceBase::ClassMethods

    attr_accessor :context

    def initialize(context={})
      @context = context
      setup_call_chain
      define_getters_and_setters

      unless skip_validation
        ValidatesExpectedKeys.new(provided_keys: context.keys).call
      end
    end

    # call is where the command's behavior is defined
    # call should be overriden by whatever class inherits from
    # this class
    def call
      error_msg = "#{self.class} - does not define a call method"
      raise SimpleService::CallNotDefinedError , error_msg
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
simple_service-1.4.1 lib/simple_service/command.rb
simple_service-1.4.0 lib/simple_service/command.rb
simple_service-1.3.91 lib/simple_service/command.rb
simple_service-1.3.9 lib/simple_service/command.rb
simple_service-1.3.8 lib/simple_service/command.rb
simple_service-1.3.5 lib/simple_service/command.rb
simple_service-1.3.4 lib/simple_service/command.rb
simple_service-1.3.3 lib/simple_service/command.rb
simple_service-1.3.2 lib/simple_service/command.rb
simple_service-1.3.1 lib/simple_service/command.rb
simple_service-1.3.0 lib/simple_service/command.rb
simple_service-1.2.6 lib/simple_service/command.rb
simple_service-1.2.5 lib/simple_service/command.rb