http://rubyblog.pro/2017/05/solid-single-responsibility-principle-by-example
puts ResponseError = Class.new(StandardError) response = .get_response(URI(url)) raise ResponseError response.code != JSON.parse(response.body) entity.new(map(response, mapping)) response.is_a?(Hash) response.is_a?(Array) response.map { |h| entity.new(map(h, mapping)) h.is_a?(Hash) } params mapping.empty? params.each_with_object({}) |(k, v), hash| hash[mapping[k] ? mapping[k] k] = v @env = env @env == RequestLogger @env = environment url = log_request(, url) posts = request_handler.send_request(url) response_processor.process(posts, Post, mapping) private @config ||= BlogServiceConfig.new( @env) @request_handler ||= RequestHandler.new @response_processor ||= ResponseProcessor.new { => , => , => , => } , , , @id = id @user_id = user_id @body = body @title = title blog_service = BlogService.new puts blog_service.posts.inspect