class BobModel

BobModel

Constants

DIMIBOB_API_URL

Public Class Methods

new(date) click to toggle source
# File lib/dimibob/bob_model.rb, line 8
def initialize(date)
  meal_date = format('%04i%02i%02i', date.year, date.month, date.day)

  begin
    response = RestClient.get DIMIBOB_API_URL + meal_date
    @bob = JSON.parse(response.body)
  rescue
    @bob = {
      breakfast: 'Have No Data',
      lunch: 'Have No Data',
      dinner: 'Have No Data',
      snack: 'Have No Data'
    }
  end
  self
end

Public Instance Methods

breakfast() click to toggle source
# File lib/dimibob/bob_model.rb, line 29
def breakfast
  @bob['breakfast'].split('/')
end
dinner() click to toggle source
# File lib/dimibob/bob_model.rb, line 37
def dinner
  @bob['dinner'].split('/')
end
lunch() click to toggle source
# File lib/dimibob/bob_model.rb, line 33
def lunch
  @bob['lunch'].split('/')
end
meal() click to toggle source
# File lib/dimibob/bob_model.rb, line 25
def meal
  @bob
end
snack() click to toggle source
# File lib/dimibob/bob_model.rb, line 41
def snack
  @bob['snack'].split('/')
end