def fetch(options={})
      params = {
        :USERNAME => @username, :PASSWORD => @password, :VNDNUMBER => @vadnumber
      }
      params[:TYPEOFREPORT] = options[:type_of_report] || REPORT_TYPE_SALES
      params[:DATETYPE] = options[:date_type] || DATE_TYPE_DAILY
      params[:REPORTTYPE] = options[:report_type] || REPORT_SUMMARY
      params[:REPORTDATE] = options[:report_date] || (Time.now-60*60*24).strftime("%Y%m%d")

      response = RestClient.post BASE_URL, params
      if response.headers[:"errormsg"]
        raise ITunesConnectError.new response.headers[:"errormsg"]
      elsif response.headers[:"filename"]
        Zlib::GzipReader.new(StringIO.new(response.body)).read
      else
        raise "no data returned from itunes: #{response.body}"
      end
    end
def fetch(options={})
      params = {
        :USERNAME => @username, :PASSWORD => @password, :VNDNUMBER => @vadnumber
      }
      params[:TYPEOFREPORT] = options[:type_of_report] || REPORT_TYPE_SALES
      params[:DATETYPE] = options[:date_type] || DATE_TYPE_DAILY
      params[:REPORTTYPE] = options[:report_type] || REPORT_SUMMARY
      params[:REPORTDATE] = options[:report_date] || (Time.now-60*60*24).strftime("%Y%m%d")

      response = RestClient.post BASE_URL, params
      if response.headers[:"errormsg"]
        raise ITunesConnectError.new response.headers[:"errormsg"]
      elsif response.headers[:"filename"]
        Zlib::GzipReader.new(StringIO.new(response.body)).read
      else
        raise "no data returned from itunes: #{response.body}"
      end
    end
Create new instance of Fetcher

 username - username
 password - password
 vadnumber - vadnumber
 Fetch and unzip report from itunes connect

 options - Hash of options:
  - :type_of_report can only be REPORT_TYPE_SALES at the moment
  - :date_type either DATE_TYPE_DAILY or DATE_TYPE_WEEKLY, default DATE_TYPE_DAILY
  - :report_type either REPORT_OPT_IN or REPORT_SUMMARY, default REPORT_SUMMARY
  - :report_date date in YYYYMMDD

 Returns text file downloaded and unzipped from iTunes