class MokiRuby::TenantManagedApp

Attributes

id[RW]
identifier[RW]
itunes_store_id[RW]
last_seen[RW]
management_flags[RW]
manifest_url[RW]
name[RW]
version[RW]

Public Class Methods

from_hash(input_hash) click to toggle source
# File lib/moki_ruby/tenant_managed_app.rb, line 6
def self.from_hash(input_hash)
  new_app = self.new
  new_app.id = input_hash["id"]
  new_app.last_seen = input_hash["lastSeen"]
  new_app.name = input_hash["name"]
  new_app.identifier = input_hash["identifier"]
  new_app.version = input_hash["version"]
  new_app.management_flags = input_hash["ManagementFlags"]
  new_app.itunes_store_id = input_hash["iTunesStoreID"]
  new_app.manifest_url = input_hash["ManifestURL"]

  new_app
end

Public Instance Methods

external_locator_hash() click to toggle source
# File lib/moki_ruby/tenant_managed_app.rb, line 50
def external_locator_hash
  if manifest_url && manifest_url != ""
    { "ManifestURL" => manifest_url }
  else
    { "iTunesStoreID" => itunes_store_id }
  end
end
install_hash() click to toggle source
# File lib/moki_ruby/tenant_managed_app.rb, line 31
def install_hash
  {
    "action" => "install_app",
    "thirdPartyUser" => "moki_ruby",
    "clientName" => "MokiRuby",
    "itemName" => self.name || "iOS App",
    "notify" => true,
    "payload" => {
                   "ManagementFlags" => self.management_flag,
                   "identifier" => self.identifier,
                   "version" => self.version
                 }.merge(self.external_locator_hash)
  }
end
management_flag() click to toggle source
# File lib/moki_ruby/tenant_managed_app.rb, line 46
def management_flag
  (!manifest_url.nil? && manifest_url != "") ? 1 : 0
end
to_hash() click to toggle source
# File lib/moki_ruby/tenant_managed_app.rb, line 20
def to_hash
  { "id" => self.id,
    "lastSeen" => self.last_seen,
    "name" => self.name,
    "identifier" => self.identifier,
    "version" => self.version,
    "ManagementFlags" => self.management_flags,
    "iTunesStoreID" => self.itunes_store_id,
    "ManifestURL" => self.manifest_url }
end