Sha256: 47fd7385d7639bbe708cae12cad34f947d5922c4b51910c49fb8c8282bd555cb

Contents?: true

Size: 1.92 KB

Versions: 9

Compression:

Stored size: 1.92 KB

Contents

# encoding: UTF-8

# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# Students process
class MockProcess
  def create_student(sObjectType, hParams)
    PrcLib.state(format("Running creation process for object '%s' = '%s'",
                        sObjectType, hParams[:student_name]))
    #  byebug if ENV['BYEBUG'] # rubocop: disable Debugger
    object = controller_create(sObjectType)
    PrcLib.runtime_fail "Student '%s' not created.",
                        hParams[:student_name] if object.nil?
    PrcLib.info("'%s': '%s' created with id %s",
                sObjectType, hParams[:student_name], object[:id])
    object
  end
end

# Declaring your data model and handlers.
class Lorj::BaseDefinition # rubocop: disable Style/ClassAndModuleChildren
  # We need to define the student object and the handler to use while we need to
  # create it.
  define_obj(:student,
             # The function to call in the class Students
             :create_e => :create_student,
             # We use predefined call to the controller query
             :query_e => :controller_query,
             # We use predefined call to the controller get
             :get_e => :controller_get,
             # We use predefined call to the controller delete
             :delete_e => :controller_delete
            )

  obj_needs :data, :student_name, :for => [:create_e], :mapping => :name
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lorj-1.0.20 lorj-spec/process/mock_process.rb
lorj-1.0.19 lorj-spec/process/mock_process.rb
lorj-1.0.18 lorj-spec/process/mock_process.rb
lorj-1.0.17 lorj-spec/process/mock_process.rb
lorj-1.0.16 lorj-spec/process/mock_process.rb
lorj-1.0.14 lorj-spec/process/mock_process.rb
lorj-1.0.13 lorj-spec/process/mock_process.rb
lorj-1.0.12 lorj-spec/process/mock_process.rb
lorj-1.0.11 lorj-spec/process/mock_process.rb