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

Checking if entry/asset is "changed" #178

Closed
andreyrd opened this issue Oct 1, 2018 · 1 comment
Closed

Checking if entry/asset is "changed" #178

andreyrd opened this issue Oct 1, 2018 · 1 comment
Assignees

Comments

@andreyrd
Copy link

andreyrd commented Oct 1, 2018

https://github.com/contentful/contentful-management.rb#entries

Currently, looks like we can check if a resource has ever been published, using my_entry.published?.
But that returns true even if the entry has been changed.

  1. Is the proper approach to check if my_entry["sys"]["updatedAt"] > my_entry["sys"]["publishedAt"]?
  2. Is it worth adding a changed? method?
@dlitvakb
Copy link
Contributor

dlitvakb commented Oct 2, 2018

Hey @andreyrd,

For 1, that's the correct approach.

For 2, #changed? may be a bad name, maybe #pending_changes? is better, and yes, can be added. But that would also mean I would need to implement #dirty? in order to differentiate changed values in the object itself vs changed values in the API.

I'll be looking into adding this very soon, as I'm going to be working this week on adding a few new features to this SDK.

Cheers

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

No branches or pull requests

2 participants