justifi-tech / justifi-ruby

JustiFi Ruby Gem
MIT License
0 stars 4 forks source link

OpenStruct responses should contain nested OpenStructs #45

Open msencenb opened 1 year ago

msencenb commented 1 year ago

When you retrieve a payment method:

pm = Justifi::PaymentMethod.get(token: 'payment token')

the data itself comes back as an OpenStruct, but the data nested inside of it is a hash.

CleanShot 2023-07-12 at 15 14 24@2x

In other words, you can't write:

pm.data.card.brand

You have to access it like this:

pm.data.card[:brand]

This one is definitely a nitpick as it's easily programmed around. Long term, it feels like there should be consistency in how the data is being returned to make accessing it easier. E.g. I don't really care if it's all a Hash or an OpenStruct, but it probably shouldn't be both.

pete2786 commented 1 year ago

Thanks for letting us know @msencenb , good point. We're going to have to think about it bit here.

msencenb commented 1 year ago

@pete2786 Yep, no problem. I'd absolutely put this one very low priority - figured I would note it while I ran into it for your future planning.