Sha256: 678d955c0e93c9a4d3712071698e3be0987c0069ac7b3529a85092bc76167a82

Contents?: true

Size: 812 Bytes

Versions: 22

Compression:

Stored size: 812 Bytes

Contents

require 'google/protobuf/well_known_types'

module Google
  module Ads
    module GoogleAds
      class StatusDecoder
        # decodes the details field from a Google::Rpc::Status instance to
        # an array of meaningful objects
        #
        # 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(status)
          status.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

22 entries across 22 versions & 1 rubygems

Version Path
google-ads-googleads-31.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-30.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-29.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-28.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-27.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-26.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-25.0.2 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-25.0.1 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-25.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-24.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-23.1.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-23.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-22.1.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-22.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-21.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-20.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-19.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-18.1.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-18.0.0 lib/google/ads/google_ads/status_decoder.rb
google-ads-googleads-17.0.0 lib/google/ads/google_ads/status_decoder.rb