Class: Google::Ads::GoogleAds::StatusDecoder
- Inherits:
-
Object
- Object
- Google::Ads::GoogleAds::StatusDecoder
- Defined in:
- lib/google/ads/google_ads/status_decoder.rb
Class Method Summary collapse
-
.decode(status) ⇒ Object
decodes the details field from a Google::Rpc::Status instance to an array of meaningful objects.
Class Method Details
.decode(status) ⇒ Object
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)
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/google/ads/google_ads/status_decoder.rb', line 13 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 |