Sha256: ca751a1f34171af356089d8df8218adb2af97b07541efb2bfe29a018ea07ee24
Contents?: true
Size: 793 Bytes
Versions: 2
Compression:
Stored size: 793 Bytes
Contents
require "hashie" require "faraday" require "faraday_middleware" require "multi_json" require "uri" module RabbitMQ module HTTP class ResponseHelper def initialize(client) @client = client end def decode_resource(response) if response.nil? || response.body.empty? Hashie::Mash.new else decode_response_body(response.body) end end def decode_response_body(body) if body.empty? Hashie::Mash.new else Hashie::Mash.new(body) end end def decode_resource_collection(response) collection = response.body.is_a?(Array) ? response.body : response.body.fetch('items') collection.map { |i| Hashie::Mash.new(i) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rabbitmq_http_api_client-2.2.0 | lib/rabbitmq/http/client/response_helper.rb |
rabbitmq_http_api_client-2.1.0 | lib/rabbitmq/http/client/response_helper.rb |