module Mashery class NoClassGiven < Exception def initialize super("Cannot create new instance for query builder because class was not given!") end end class InvalidDateRange < Exception 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 end class QueryParamMissing < Exception def initialize(param) super "Couldn't complete request. The query param #{param.inspect} is missing." end end class ParamMissing < Exception def initialize(param) super "Couldn't determine Mashery #{param.inspect}! Please check your config/mashery.yml" end end class ConfigMissing < Exception def initialize super "No configuration has been loaded! Please call Mashery.load_config! with a valid Yaml file." end end class MissingConfig < Exception def initialize super("Couldn't find config/mashery.yml! \n" + "Please run `rails g mashery:install` to create one and populate it with the necessary API credentials.") end end class UnknownFormat < Exception def initialize(format) super "Unknown format #{format.inspect} for REST API call. Standard formats are CSV and JSON." end end end