googleads / google-api-ads-ruby

Ad Manager SOAP API Client Libraries for Ruby
297 stars 227 forks source link

ReportableType is unexpected when creating CustomTargetingKey #170

Closed agejevasv closed 4 years ago

agejevasv commented 4 years ago

CustomTargetingKey type has reportableType as one of supported fields (https://developers.google.com/ad-manager/api/reference/v202002/CustomTargetingService.CustomTargetingKey#reportableType), but if it is included when creating a key, service call fails with:

AdsCommon::Errors::UnexpectedParametersError: [:reportableType]

Here's an example code that could be used to reproduce it. It works if reportableType: 'ON' is removed from the key:

require 'ad_manager_api'

def create_custom_targeting_keys_and_values(ad_manager)
  custom_targeting_service = ad_manager.service(:CustomTargetingService, API_VERSION)

  key = {
    display_name: 'test',
    name: 'test',
    type: 'PREDEFINED',
    reportableType: 'ON'
  }

  custom_targeting_service.create_custom_targeting_keys([key])
end

if __FILE__ == $0
  API_VERSION = :v202002
  ad_manager = AdManagerApi::Api.new
  create_custom_targeting_keys_and_values(ad_manager)
end

Is there some issue on my part or is this field was not meant to be used when creating a new key?

agejevasv commented 4 years ago

Closing, my issue was reportableType should be reportable_type.