We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've found issue in https://github.com/facebook/facebook-ruby-ads-sdk/blob/master/lib/facebook_ads/ad_object.rb#L48 when using insights creation api.
def initialize(attributes, *args) ... self.fields = fields + attributes.keys ... end
above self.fields is usually calling def fields=(fields) below when there are no field: fields declared.
self.fields
def fields=(fields)
field: fields
https://github.com/facebook/facebook-ruby-ads-sdk/blob/master/lib/facebook_ads/ad_object.rb#L96
But there is one place field: fields declared found below
https://github.com/facebook/facebook-ruby-ads-sdk/blob/master/lib/facebook_ads/ad_objects/ad_report_run.rb#L52
so when it goes to
self.fields = fields + attributes.keys
it tries to access below method with name=fields instead of calling instance method fields=
name=fields
fields=
def define_writer(name) define_method("#{name}=") do |val| changes[name] = val @fields.add(name.to_s) end end
FacebookAds::AdAccount.get('act_xxxxxx').insights(fields: 'ad_report_run').create(level: 'ad', fields: ['ad_id'])
This will throw exception NoMethodError: undefined method `add' for nil:NilClass
NoMethodError: undefined method `add' for nil:NilClass
Just rename instance method def fields=(fields) to either def _fields=(fields) or more explicitly def response_fields=(fields)
def _fields=(fields)
def response_fields=(fields)
The text was updated successfully, but these errors were encountered:
field :fields
No branches or pull requests
Issue
I've found issue in https://github.com/facebook/facebook-ruby-ads-sdk/blob/master/lib/facebook_ads/ad_object.rb#L48 when using insights creation api.
above
self.fields
is usually callingdef fields=(fields)
below when there are nofield: fields
declared.https://github.com/facebook/facebook-ruby-ads-sdk/blob/master/lib/facebook_ads/ad_object.rb#L96
But there is one place
field: fields
declared found belowhttps://github.com/facebook/facebook-ruby-ads-sdk/blob/master/lib/facebook_ads/ad_objects/ad_report_run.rb#L52
so when it goes to
it tries to access below method with
name=fields
instead of calling instance methodfields=
How to replicate this issue
FacebookAds::AdAccount.get('act_xxxxxx').insights(fields: 'ad_report_run').create(level: 'ad', fields: ['ad_id'])
This will throw exception
NoMethodError: undefined method `add' for nil:NilClass
Suggestion to fix
Just rename instance method
def fields=(fields)
to eitherdef _fields=(fields)
or more explicitlydef response_fields=(fields)
The text was updated successfully, but these errors were encountered: