Sha256: 74e77157a019e7d246ccfa502c604d650824f8533b009bc09884f0c55e21cdac

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

module Aua::Agents::MiscMobiles

  def self.extend?(agent)
    BYTEPOETS.include?(agent.app) ||
    agent.app == "MightyMiteToday" ||
    agent.app == "MiteClocks" ||
    agent.app == "MiteTimer"
  end

  BYTEPOETS = ["BytepoetsMite", "com.bytepoets.mightymite", "com.bytepoets.MightyMite"]
  IOS_VERSION_PATTERN = /(iOS|iPhone OS) ([\d\.]+)/

  def type
    :ApiClient
  end

  def version
    version_of(name) || (parts[1] && parts[1][0] =~ /^[\d\.]+$/ ? parts[1][0] : nil) || version_of(app)
  end

  def name
    BYTEPOETS.include?(app) ? :BytepoetsMite : app.to_sym
  end

  def platform
    @platform ||= begin
      if app_comments.first =~ /^iPod/
        :iPod
      elsif app_comments.first =~ /^iPad/
        :iPad
      else
        :iPhone
      end
    end
  end

  def os_version
    @os_version ||= begin
      if  app_comments[0] =~ IOS_VERSION_PATTERN ||
          app_comments[1] =~ IOS_VERSION_PATTERN ||
          comments[1] && comments[1][1] =~ IOS_VERSION_PATTERN
        $2
      end
    end
  end

  def os_name
    :iOS
  end

  def app_comments
    org = super
    if org && org != ""
      org
    else
      comments[1]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aua-mite-0.0.8 lib/aua-mite/agents/misc_mobiles.rb
aua-mite-0.0.7 lib/aua-mite/agents/misc_mobiles.rb