Decathlon / sports-api-wrapper

Sports API wrapper
MIT License
3 stars 2 forks source link

Allow sports to be searchable #2

Closed alextoul closed 5 years ago

alextoul commented 5 years ago

Decathlon::Sports.where(name: 'Snowboarding')

Decathlon::Sports.find(71) isn't readable

CaioBianchi commented 5 years ago

This works with the slug property for now. E.g.:

Decathlon::Sports.find('snowboarding')

I'll improve it to be a bit smarter and query the elasticsearch index when a string is passed in.

alextoul commented 5 years ago

Cool! Not documented on developers.decathlon.com then ?

CaioBianchi commented 5 years ago

@alextoul The above PR adds a method that will search the index (via ElasticSearch) for the name of the sport via a .search method as such:

Decathlon::Sports.search('snowboarding')