Sha256: ecd5f03570548a84215c64d6b273844287fb0ae7a490b24a30ed48f1559e1c6d

Contents?: true

Size: 702 Bytes

Versions: 25

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

require 'eac_rest/error'
require 'eac_envs/http/error'
require 'eac_ruby_utils/core_ext'

module EacRest
  class Response < ::StandardError
    common_constructor :request
    delegate :body_data_proc, to: :request

    def internal_response
      @internal_response ||= request.internal_request.response
    end

    %i[body_data body_data_or_raise body_str body_str_or_raise header headers
       link links raise_unless_200 status to_s url].each do |method_name|
      define_method method_name do |*args, &block|
        internal_response.send(method_name, *args, &block)
      rescue ::EacEnvs::Http::Error
        raise ::EacRest::Error
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
eac_tools-0.75.1 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.75.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.74.1 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.74.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.73.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.72.0 sub/eac_rest/lib/eac_rest/response.rb
eac_rest-0.9.1 lib/eac_rest/response.rb
eac_tools-0.70.1 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.70.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.69.1 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.69.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.68.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.67.1 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.67.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.66.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.65.1 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.65.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.64.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.63.0 sub/eac_rest/lib/eac_rest/response.rb
eac_tools-0.62.1 sub/eac_rest/lib/eac_rest/response.rb