Module: CPEE::Instantiation

Defined in:
lib/cpee/instantiation.rb

Defined Under Namespace

Modules: Helpers Classes: ContinueTask, HandleInstance, InstantiateUrl, InstantiateXML

Constant Summary collapse

SERVER =
File.expand_path(__dir__ + '/../instantiation.xml')

Class Method Summary collapse

Class Method Details

.implementation(opts) ⇒ Object

}}}



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/cpee/instantiation.rb', line 266

def self::implementation(opts)
  opts[:cpee] ||= 'http://localhost:9298/'
  opts[:self] ||= "http#{opts[:secure] ? 's' : ''}://#{opts[:host]}:#{opts[:port]}/"
  opts[:cblist] = Redis.new(path: "/tmp/redis.sock", db: 14)
  Proc.new do
    on resource do
      run InstantiateXML, opts[:cpee], true if post 'xmlsimple'
      on resource 'xml' do
        run InstantiateXML, opts[:cpee], false if post 'xml'
      end
      on resource 'url' do
        run InstantiateUrl, opts[:cpee], opts[:self], opts[:cblist] if post 'url'
      end
      on resource 'instance' do
        run HandleInstance, opts[:cpee] if post 'instance'
      end
      on resource 'callback' do
        on resource do
          run ContinueTask, opts[:cpee], opts[:cblist] if post
        end
      end
    end
  end
end