Unable to update fields with Content Management API in Ruby

Hello!, I need to write a small snippet in ruby to update some contents, is a couple of hours I’m struggling to get the job done! I don’t know what is missing or where I hade the error.
This is the code:

client = Contentful::Management::Client.new(<My Key>)
environment = client.environments(<my Space ID).find(<my Environment ID>)
url = '<some url>'

entry = environment.entries.all('content_type' => 'designers', 'fields.website' => url)
entry.items.each do |x|
  x.fields.update('shopify_entry' => true)
  x.publish()
end

I have no errors, the code is executed and the entry is re-published, however I got no changes.
What I’m missing?, documentation is not very clear or at least I’ve not understood well. I tried to add x.save before x.publish() but nothing changes.
Thanks for you help.
F

Try x.publish without parenthesis. I have a very similar functionality in my project. Look at the update_episode_downloads method in the link below.

Hi teemu.tammela1,
thank you for spot the error on publish, but I think the problem I have is on the line before, I get nil and still don’t understand why. I manage to do all the process in python and it worked, thanks for your help though.
F