Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evil::Client::Dictionary will not support keyword arguments? #32

Open
NaturalHokke opened this issue Dec 16, 2022 · 4 comments
Open

Evil::Client::Dictionary will not support keyword arguments? #32

NaturalHokke opened this issue Dec 16, 2022 · 4 comments
Assignees

Comments

@NaturalHokke
Copy link

---
# config.yml
- name: "A"
  code: 65
- name: "B"
  code: 66
class Codepoint < Evil::Client::Model
  extend  Evil::Client::Dictionary["config.yml"]

  option :name
  option :code
end

Codepoint.all
# => `new': wrong number of arguments (given 1, expected 0)
@mrexox
Copy link
Member

mrexox commented Dec 16, 2022

Hey @NaturalHokke! Try changing YAML keys this way:

---
# config.yml
- :name: "A"
  :code: 65
- :name: "B"
  :code: 66

I hope this helps. But if not, please, write back and we'll try to figure out the problem 🤔

@NaturalHokke
Copy link
Author

thanks help @mrexox !
but the problem was not solved 😢

Specifically, I tried to use nepalez/ebay_api, but it wouldn't work.
EbayAPI::Currency and dictionary.yml

@nepalez nepalez self-assigned this Dec 19, 2022
@nepalez
Copy link
Member

nepalez commented Jan 18, 2023

I suspect you're using ruby 3+, so the problem is not in the keys, but in the difference between new(opts) and new(**opts). The last syntax was the only supported 🤷‍♂️ because who could expect this difference 7 years ago

So the problem is that Evil::Client::Model.new expects key arguments, while the dictionary provides a hash argument.
Please check if I fixed your problem in v 3.2.0

@NaturalHokke
Copy link
Author

Thanks! EbayAPI::Currency solved the problem!
But EbayAPI::Site continues to not seem to work... 🤔

🆖 EbayAPI::Site.new EbayAPI::Site.raw.first
🆗 EbayAPI::Site.new **EbayAPI::Site.raw.first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants