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

AdCampaignDeliveryEstimate TypeError problems #34

Closed adam-szczombrowski closed 4 years ago

adam-szczombrowski commented 6 years ago

Hi, maybe I'm not getting something here but when I get delivery estimate for adset I cannot read the responses data, almost all methods beside to_yaml return

TypeError: no implicit conversion of Hash into String. It seems to me like there is a bug in the gem.

adam-szczombrowski commented 6 years ago

@alanho could you please look into it? I'm unable to get any attribute values on delivery_estimate object. It always returns Undefined method estimate_dau and similar to that.

alanho commented 6 years ago

hi @adam-szczombrowski , sorry for the delayed response. do you have any sample code that could reproduce the problem that i could look at?

adam-szczombrowski commented 6 years ago
client = FacebookAds::AdAccount.get(@account_id, {access_token: @access_token, app_secret: FacebookAds.config.app_secret })

delivery_estimate = client.adsets.first.delivery_estimate

and now whenever trying to send methods to delivery_estimate object it raises TypeError (the only method I found working is to_yaml)

adam-szczombrowski commented 6 years ago

@alanho here is the output from rails console:

[1] pry(main)> client = Facebook::GetClient.new(User.first).call
  User Load (2.2ms)  SELECT  "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1  [["LIMIT", 1]]
=> #<FacebookAds::AdAccount {:id=>"act_103551207093597"}>
[2] pry(main)> estimate = client.adsets.first.delivery_estimate
=> #<#<Class:0x007f90499d9550>:0x007f904c470368
 @name=:delivery_estimate,
 @node=#<FacebookAds::AdSet {:id=>"120330000018073214"}>,
 @options={},
 @should_delegate=false>
[3] pry(main)> estimate.first
TypeError: no implicit conversion of Hash into String
from /Users/adam/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/json-2.1.0/lib/json/common.rb:156:in `initialize'
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.