Skip to content
New issue

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

Calling get_feed(FEED_ID) results in undefined method `build_from_hash' for Feed:Class #33

Open
noorani786 opened this issue Oct 19, 2022 · 4 comments

Comments

@noorani786
Copy link

After successfully submitting a feed, when we call get_feed(FEED_ID), it always throws this error:

7: from /var/www/ncube_ecomm/releases/20221019163120/app/proxies/amzn_sp_api/feed_proxy.rb:19:inget_feed'
6: from /var/www/ncube_ecomm/shared/bundle/ruby/2.5.0/gems/amz_sp_api-1.0.0/lib/feeds-api-model/api/feeds_api.rb:190:in get_feed' 5: from /var/www/ncube_ecomm/shared/bundle/ruby/2.5.0/gems/amz_sp_api-1.0.0/lib/feeds-api-model/api/feeds_api.rb:226:in get_feed_with_http_info'
4: from /var/www/ncube_ecomm/shared/bundle/ruby/2.5.0/gems/amz_sp_api-1.0.0/lib/sp_api_client.rb:18:in call_api' 3: from /var/www/ncube_ecomm/shared/bundle/ruby/2.5.0/gems/amz_sp_api-1.0.0/lib/api_client.rb:72:in call_api'
2: from /var/www/ncube_ecomm/shared/bundle/ruby/2.5.0/gems/amz_sp_api-1.0.0/lib/api_client.rb:200:in deserialize' 1: from /var/www/ncube_ecomm/shared/bundle/ruby/2.5.0/gems/amz_sp_api-1.0.0/lib/api_client.rb:239:in convert_to_type'
NoMethodError (undefined method build_from_hash' for Feed:Class)

Can you please fix it?

@ericcj
Copy link
Owner

ericcj commented Oct 20, 2022

we use this method successfully. do you have another class named Feed in your codebase and what is its namespace? the one it intends to use has a build_from_hash method https://github.com/ericcj/amz_sp_api/blob/main/lib/feeds-api-model/models/feed.rb#L222 but i wouldn't be surprised if there was a bug in this line that somehow is picking up yours https://github.com/ericcj/amz_sp_api/blob/main/lib/api_client.rb#L239

@dicksonwu2000
Copy link

I am getting same error, using ruby-3.3.2 ETHON: performed EASY effective_url=https://sellingpartnerapi-na.amazon.com/reports/2021-06-30/reports/105390019918 response_code=200 return_code=ok total_time=0.137147
app/models/amazon_seller_orderv2.rb:75:in load': undefined method build_from_hash' for class Report (NoMethodError)
from (irb):3:in `

'

@mendywoly
Copy link
Contributor

You most likely have a report model, add this method to your model.

Class Report 

…

def self.build_from_hash(data)
   AmzSpApi::ReportsApiModel::Report.build_from_hash(data)
  end

…

end

@dicksonwu2000
Copy link

Thank you @mendywoly. You are correct. It works perfectly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants