class PlayTime::Apk

Constants

MIME_TYPE

Public Class Methods

load() click to toggle source
# File lib/play_time/apk.rb, line 10
def load
  Google::APIClient::UploadIO.new(most_recent_modified_file_path, MIME_TYPE)
end

Private Class Methods

file_path() click to toggle source
# File lib/play_time/apk.rb, line 16
def file_path
  PlayTime.configuration.apk_path
end
most_recent_modified_file_path() click to toggle source
# File lib/play_time/apk.rb, line 20
def most_recent_modified_file_path
  @most_recent_modified_file_path ||=
    begin
      file = Dir[file_path].map{|file_path| File.open(file_path) }.sort_by(&:mtime).last

      if file
        file.path
      else
        raise FileNotFound, "No such file or directory: #{file_path}"
      end
    end
end