Exception: Masheri::InvalidDateRange

Inherits:
Exception
  • Object
show all
Defined in:
lib/masheri/exceptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(start_date, end_date) ⇒ InvalidDateRange

Returns a new instance of InvalidDateRange.



9
10
11
12
13
# File 'lib/masheri/exceptions.rb', line 9

def initialize(start_date, end_date)
  days = ((end_date - start_date) / 1.day).ceil

  super("Your start_date and end_date are #{days} days apart. Mashery's API does not like date ranges that span longer than 7 days. Please use multiple queries to gather your data.")
end