Sha256: 32bc29067b85873f9d0eb7029f1d72c7d22fc75993effe532013560d9d71de32
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require 'alephant/broker/models/request' module Alephant module Broker class PostRequest < Request attr_reader :type, :component_id, :options, :content_type def initialize @env = RequestStore.store[:env] @content_type = 'application/json' super(:batch) end def components @requested_components ||= components_for @env.path end def set_component(id, options) @component_id = id @options = options end private def components_for(path) request_parts = path.split('/') { :batch_id => batch_id, :type => get_type_from(request_parts), :component_id => get_component_id_from(request_parts) }.merge! batched end def batch_id @env.data['batch_id'] end def batched @env.data['components'].reduce({ :components => [] }) do |obj, component| obj.tap { |o| o[:components].push(component) } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alephant-broker-0.1.0 | lib/alephant/broker/models/request/post_request.rb |