facebook / facebook-ruby-business-sdk

Ruby SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
209 stars 160 forks source link

AdImage IDs lead to invalid URI generation #23

Closed stex closed 4 years ago

stex commented 7 years ago

AdImage IDs seem to consist of the account ID and the image hash with a colon as separator. This leads to URI::InvalidURIError exceptions when trying to load the resource by its ID.

A minimum example:

image = FacebookAds::AdAccount.get('act_12345678').adimages.first
image.hash
# => "feb391c9e7045348b52ef2081ed22830"

image.reload! # everything except the ID is cleared
image.hash
#=> URI::InvalidURIError: bad URI(is not URI?): 12345678:feb391c9e7045348b52ef2081ed22830
mantas commented 7 years ago

@Stex did you figure this out yet?

stex commented 7 years ago

@mantas I didn't have much time yet to search for a proper solution that would involve altering this gem, so I went with the most suboptimal one for now (that will most likely kill your API quota quickly):

@account.adimages(fields: ...).find { |i| i.hash == id }
stale[bot] commented 4 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.