class YuiRestClient::Http::Response
Public Class Methods
new(res)
click to toggle source
# File lib/yui_rest_client/http/response.rb, line 6 def initialize(res) @res = res end
Public Instance Methods
body(regex_filter: {})
click to toggle source
# File lib/yui_rest_client/http/response.rb, line 10 def body(regex_filter: {}) result = JSON.parse(@res.body, symbolize_names: true) result.select do |widget| regex_filter.all? { |key, value| value.match(widget[key.to_sym]) } end rescue JSON::ParserError => e YuiRestClient.logger.error("Error while parsing JSON from response:\n"\ "#{e.message}\n#{e.backtrace.inspect}") end