#mentijm

1 messages · Page 1 of 1 (latest)

topaz turtleBOT
trim anvil
#

Hi there!

fresh beacon
#

Hey soma!

trim anvil
#

Can you clarify exactly what you are trying to do?

#

Maybe an example would help.

fresh beacon
#

I want to alter a customer name and address for example. Then I want to see if that stripe object has changed before persisting in stripe.

#

I get a customer from a repository. I alter the resource locally. I want to be able to check if the object has changed before making an call to stripe to update the resource

#

for example my ORM resource has modified? and changed_fields functions. This is kinda what I'm looking for but in Stripe gem

crystal meadow
#

basically we don't recommend integrating that way at all(modifying the object locally and then save-ing later) anymore, you should only ever be making declarative calls like thing = Stripe::Thing.update(...) , so I'm not aware of us having anything like what you're describing exposed in the SDK

fresh beacon
#

Okok thanks for that input. Is it possible to send the whole object for you to figure out the diff and safe?

#

Or would you say that's the same thing basically 😄

crystal meadow
#

hmm that's not how the API works, in general if you pass a field it change thats value, if you don't pass it that field doesn't chnge.
You can look at https://github.com/stripe/stripe-ruby/blob/master/lib/stripe/api_operations/save.rb and see it doesn't actually do anything advanced or try to figure out what has changed.
Also the shape of an object is not always the same as the shape of the update parameters for the object so you can't just send the exact JSON you get from the API.

overall if you want something like a meta-object on your side and then you only submit the 'dirty' fields in an update call to the API that's logic you'd need to build, we try to keep that complexity out of the API/SDK themselves