ynab / ynab-sdk-ruby

YNAB API Client for Ruby
https://api.ynab.com
Apache License 2.0
65 stars 12 forks source link

Invalid value for "goal_type" #49

Closed lukemcfarlane closed 4 years ago

lukemcfarlane commented 4 years ago

I am getting the following error when trying to retrieve retrieve a budget by ID using the latest version of this gem (1.6.0):

ArgumentError: invalid value for "goal_type", must be one of #{validator.allowable_values}.

The code that triggers this error is:

api = YNAB::API.new(YNAB_ACCESS_TOKEN)
api.budgets.get_budget_by_id('last-used').data.budget

The error is occurring in /lib/ynab/models/category.rb:281

I found the following from debugging:

[1] pry(#<YNAB::Category>)> goal_type
=> "NEED"
[2] pry(#<YNAB::Category>)> validator.allowable_values
=> ["TB", "TBD", "MF"]

I noticed that the YNAB goal types in the UI have changed, so I'm guessing that the validation just needs to be updated to match?

lukemcfarlane commented 4 years ago

Sorry I just realized that this fix is already in master. I assumed the 1.6.0 published release was the latest version: https://github.com/ynab/ynab-sdk-ruby/releases

bradymholt commented 4 years ago

Glad you figured it out. Yes, the latest version v1.15.0 which is on RubyGems should have this change. I'll add an issue to start updating the GH releases page when we release to avoid confusion here.