Class: PProf::Entitlements

Inherits:
Object
  • Object
show all
Defined in:
lib/pprof/entitlements.rb

Overview

Represents the list of entitlements in a Provisioning Profile

Instance Method Summary collapse

Constructor Details

#initialize(dict) ⇒ Entitlements

Create a new Entitlements object from the hash representation extracted from the Provisioning Profile

Parameters:

  • dict (Hash)

    The hash representation of the entitlements, typically extracted from the Provisioning Profile.



13
14
15
# File 'lib/pprof/entitlements.rb', line 13

def initialize(dict)
  @dict = dict
end

Instance Method Details

#[](key) ⇒ Object

Generic access to any entitlement by key

Parameters:

  • key (#to_s)

    The entitlement key to read



94
95
96
# File 'lib/pprof/entitlements.rb', line 94

def [](key)
  @dict[key.to_s]
end

#app_groupsArray<String>

The Application Groups registered in the entitlements

Returns:

  • (Array<String>)


57
58
59
# File 'lib/pprof/entitlements.rb', line 57

def app_groups
  @dict['com.apple.security.application-groups']
end

#app_idString

The full application identifier (including the team prefix), as specified in the entitlements

Returns:

  • (String)


35
36
37
# File 'lib/pprof/entitlements.rb', line 35

def app_id
  @dict['application-identifier']
end

#aps_environmentString

The Apple Push Service environment used for push notifications. Typically either ‘development’ or ‘production’, or ‘nil` if push isn’t enabled.

Returns:

  • (String)


50
51
52
# File 'lib/pprof/entitlements.rb', line 50

def aps_environment
  @dict['aps-environment']
end

#beta_reports_activeBool

Are Beta (TestFlight) reports active?

Returns:

  • (Bool)


64
65
66
# File 'lib/pprof/entitlements.rb', line 64

def beta_reports_active
  @dict['beta-reports-active']
end

#get_task_allowBool

The status of the ‘get-task-allow` flag. True if we can attach a debugger to the executable, false if not.

Returns:

  • (Bool)


28
29
30
# File 'lib/pprof/entitlements.rb', line 28

def get_task_allow # rubocop:disable Naming/AccessorMethodName
  @dict['get-task-allow']
end

#healthkitBool

True if the HealthKit entitlement is set

Returns:

  • (Bool)


71
72
73
# File 'lib/pprof/entitlements.rb', line 71

def healthkit
  @dict['com.apple.developer.healthkit']
end

#key?(key) ⇒ Boolean Also known as: has_key?

Check if a given entitlement key is present

Parameters:

  • key (#to_s)

    The key to check

Returns:

  • (Boolean)


103
104
105
# File 'lib/pprof/entitlements.rb', line 103

def key?(key)
  @dict.key?(key.to_s)
end

#keychain_access_groupsArray<String>

The list of Keychain Access Groups

Returns:

  • (Array<String>)


20
21
22
# File 'lib/pprof/entitlements.rb', line 20

def keychain_access_groups
  @dict['keychain-access-groups']
end

#keysArray<String>

The list of all entitlement keys, as String

Returns:

  • (Array<String>)


112
113
114
# File 'lib/pprof/entitlements.rb', line 112

def keys
  @dict.keys.map(&:to_s)
end

#team_idString

The Team Identifier

Returns:

  • (String)


42
43
44
# File 'lib/pprof/entitlements.rb', line 42

def team_id
  @dict['com.apple.developer.team-identifier']
end

#to_hashHash

The hash representation of the entitlements (as represented in their PLIST form)

Returns:

  • (Hash)


119
120
121
# File 'lib/pprof/entitlements.rb', line 119

def to_hash
  @dict
end

#to_sString

The pretty-printed list of all entitlement keys and values (as a multi-line dashed list for human reading)

Returns:

  • (String)


127
128
129
130
131
# File 'lib/pprof/entitlements.rb', line 127

def to_s
  @dict.map do |key, value|
    "- #{key}: #{value}"
  end.join("\n")
end

#ubiquity_container_identifiersArray<String>

The Ubiquity Container identifiers, if at least one is enabled

Returns:

  • (Array<String>)


78
79
80
# File 'lib/pprof/entitlements.rb', line 78

def ubiquity_container_identifiers
  @dict['com.apple.developer.ubiquity-container-identifiers']
end

#ubiquity_kvstore_identifierString

The Ubiquity Key-Value Store Identifier, if enabled.

Returns:

  • (String)


85
86
87
# File 'lib/pprof/entitlements.rb', line 85

def ubiquity_kvstore_identifier
  @dict['com.apple.developer.ubiquity-kvstore-identifier']
end