Module: Api::RootService::RootResponse
- Defined in:
- app/middleware/api/root_service.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#services(services) ⇒ Object
rubocop:todo Metrics/MethodLength.
Class Method Details
.each(&block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/middleware/api/root_service.rb', line 24 def @owner.each(&block) ::Core::Io::Buffer.new(block) do |buffer| ::Core::Io::Json::Stream .new(buffer) .open do |stream| stream.attribute('revision', 2) object.each do |model_in_json, endpoint| stream.block(model_in_json) do |nested_stream| nested_stream.block('actions') do |actions_stream| endpoint .model_handler .send(:actions, endpoint.model_handler, response: self, endpoint: endpoint) .map { |action, url| actions_stream.attribute(action, url) } end end end end end end |
Instance Method Details
#services(services) ⇒ Object
rubocop:todo Metrics/MethodLength
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/middleware/api/root_service.rb', line 22 def services(services) # rubocop:todo Metrics/AbcSize self.object = services def @owner.each(&block) ::Core::Io::Buffer.new(block) do |buffer| ::Core::Io::Json::Stream .new(buffer) .open do |stream| stream.attribute('revision', 2) object.each do |model_in_json, endpoint| stream.block(model_in_json) do |nested_stream| nested_stream.block('actions') do |actions_stream| endpoint .model_handler .send(:actions, endpoint.model_handler, response: self, endpoint: endpoint) .map { |action, url| actions_stream.attribute(action, url) } end end end end end end end |