paymill / paymill-ruby

Ruby wrapper for the Paymill API
MIT License
23 stars 16 forks source link

Inline update with passing arguments doesn't work #17

Closed morgoth closed 9 years ago

morgoth commented 9 years ago

Having:

client = Paymill::Client.find("client_id")
client.update(description: "description")

doesn't work

nikoloff commented 9 years ago

Hi @morgoth update don't get inline parameters during its execution for its instance. You should do:

client = Paymill::Client.find("client_id")
client.description = "description"
client.update

You can pass parameters to update and delete only when there are some cascading functionality, which is not relevant to the instance. like:

offer = Offer.find( 'offer_b54ff8b3811e06c02e14' )
offer.amount = 1000

offer.update( update_subscriptions: true )

or

offer = Offer.find( 'offer_b54ff8b3811e06c02e14' )
offer.delete( remove_with_subscriptions: true )
morgoth commented 9 years ago

I would expect that this way is working. Anyway, do you think it could raise an error on unsupported attributes passed in, to avoid such confusion?

nikoloff commented 9 years ago

This should be tested with CURL, but my guess is that it will raise an error, because the API don't support it.

Do you have suggestions how we can build the interface for cascading parameters, which are not part of the model, but can be passed to update or delete method?

nikoloff commented 9 years ago

@morgoth I have tested this, and the API throws an error when unknown argument is given.

Update and delete are getting only cascading arguments. The instance attributes are set with accessors. So if you are ok I would like to close this issue.

morgoth commented 9 years ago

sure