chargify / chargify_api_ares

A Chargify API wrapper for Ruby using ActiveResource
http://chargify.com
MIT License
161 stars 96 forks source link

ManagementLink return value always Array when it should be a Hash #180

Closed alexanderames closed 3 years ago

alexanderames commented 3 years ago

If I'm calling this wrong please let me know and I'll promptly close this issue, but every time I try and retrieve the Management link I get the following error:

irb(main):001:0> Chargify::ManagementLink.where(customer_id: 39244918)
Traceback (most recent call last):
        1: from (irb):1
ArgumentError (expected attributes to be able to convert to Hash, got ["url", "https://www.billingportal.com/manage/39244918/1614821384/50c8b03B1750fbfd"])

I think what's most annoying is that I can see the link right in the error, and it's the right link, but it only returns it in an error message not the actual object.

I thought maybe it might be an ActiveResource error so I bundled with dependabot/bundler/activeresource-5.1.1 branch. But I still get the error. Please help!

alexanderames commented 3 years ago

so after a little digging I found that I could grab the Management Link off the Customer using:

customer = Chargify::Customer.find(:customer_id)
link = customer.management_link.attributes.url

closing issue.