Unable to get data with granularity of "day" using twitter-ads gem


I’m using the twitter-ads gem to retrieve campaign data during a given time interval, but if specify the granularity as :day, I keep getting an error saying “Expect time to be midnight in the account’s local timezone for day granularity”.

Here’s an example line where that error happens:
TwitterAds::LineItem.stats(account, ids, metrics, {granularity: :day, start_time: start_date, end_time: end_date})

I’ve tried different flavours of start_date and end_date, including using .in_time_zone("GMT") and setting Time.zone and then using Time.zone.local, but to no avail.

I’ve seen some topics discussing this issue already, but none of them mentioned how to solve it when using the gem.

Is anyone else having the same issue?


@gruvimoviesuk: Thanks for reaching out and for providing these details. It sounds like an issue we had with the Python SDK that we fixed a few months back: #70. If you’d like to submit a pull request, that would be great. Otherwise, we’ll take a look at the Ruby SDK.