googleads / google-api-ads-ruby

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

Missing elements in :order! [:start_date, :end_date] #107

Closed Michael1969 closed 7 years ago

Michael1969 commented 8 years ago

which order?

` #:date_range_type => 'ALL_TIME' report = adwords.report_utils select = {

      :selector => {
          :fields => ['CampaignId','CampaignStatus','CampaignName', 'Impressions', 'Clicks', 'Cost', 'Amount', 'StartDate', 'EndDate']
      },
      :report_name => 'Report',
      :report_type => 'CAMPAIGN_PERFORMANCE_REPORT',

      :download_format => 'XML' ,
  :date_range_type => 'CUSTOM_DATE',
      :start_date => {:year => start[0],
                      :month => start[1],
                      :day => start[2]},
      :end_date => {:year => ends[0],
                    :month => ends[1],
                    :day => ends[2]},
  }`
dklimkin commented 8 years ago

This error occurs when the key name is invalid, here both of [:start_date, :end_date]

Those fields need to be under selector.

Mike, can we improve an error thrown here?

mcloonan commented 8 years ago

The selector should be like this:

:selector => {
  :fields => [ ... ],
  :date_range => {
    :min => 'YYYYMMDD',
    :max => 'YYYYMMDD'
  }

Then remove the :start_date and :end_date elements from your hash as well.

I'll leave this bug open for now until I get a chance to wrap this error into a more descriptive one.

mcloonan commented 7 years ago

The latest release now gives a more descriptive error message for this case.