Class: Mat::CLI
- Inherits:
-
Object
- Object
- Mat::CLI
- Defined in:
- lib/mat/cli.rb
Class Method Summary collapse
Class Method Details
.get_data(query) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/mat/cli.rb', line 10 def get_data(query) if query.to_s.match(/^\d+$/) Mat.api.foodstuff(query) else Mat.api.foodstuffs(query) end end |
.search(query) ⇒ Object
18 19 20 21 22 |
# File 'lib/mat/cli.rb', line 18 def search(query) puts JSON.pretty_generate get_data(query) rescue Mat::HTTP::Exception warn "Nothing found" end |