Sha256: 32a2b1c713cf93f6f3cbcf8dd102b0ca6eee810fc2d40d38d23c786b6b552a4b

Contents?: true

Size: 861 Bytes

Versions: 10

Compression:

Stored size: 861 Bytes

Contents

require 'google/protobuf/well_known_types'

module Google
  module Ads
    module GoogleAds
      class PartialFailureErrorDecoder
        # decodes a partial_failure_error (Google::Rpc::Status instance) to
        # an array of meaningful error protos
        #
        # Return an Array of protobuf objects, typed depending on what was
        # in the passed object (which will mostly be Google::Protobuf::Any,
        # so the types could be any valid protobuf type)
        def self.decode(partial_failure_error)
          partial_failure_error.details.select { |detail|
            Google::Protobuf::Any === detail
          }.map { |detail|
            type = Google::Protobuf::DescriptorPool.generated_pool.lookup(
              detail.type_name
            ).msgclass
            detail.unpack(type)
          }
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
google-ads-googleads-14.0.0 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-13.0.0 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-12.0.2 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-12.0.1 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-11.0.0 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-10.0.0 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-9.0.0 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-8.1.0 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-8.0.0 lib/google/ads/google_ads/partial_failure_error_decoder.rb
google-ads-googleads-7.0.0 lib/google/ads/google_ads/partial_failure_error_decoder.rb