Module: Match::Portal::Fetcher

Defined in:
match/lib/match/portal_fetcher.rb

Class Method Summary collapse

Class Method Details

.bundle_ids(bundle_id_identifiers: nil) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'match/lib/match/portal_fetcher.rb', line 61

def self.bundle_ids(bundle_id_identifiers: nil)
  filter = { identifier: bundle_id_identifiers.join(',') } if bundle_id_identifiers

  bundle_ids = Spaceship::ConnectAPI::BundleId.all(
    filter: filter
  )

  bundle_ids
end

.certificates(platform:, profile_type:, additional_cert_types:) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'match/lib/match/portal_fetcher.rb', line 27

def self.certificates(platform:, profile_type:, additional_cert_types:)
  require 'sigh'
  certificate_types = Sigh.certificate_types_for_profile_and_platform(platform: platform, profile_type: profile_type)

  additional_cert_types ||= []
  additional_cert_types.map! do |cert_type|
    case Match.cert_type_sym(cert_type)
    when :mac_installer_distribution
      Spaceship::ConnectAPI::Certificate::CertificateType::MAC_INSTALLER_DISTRIBUTION
    when :developer_id_installer
      Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_INSTALLER
    end
  end

  certificate_types += additional_cert_types

  filter = { certificateType: certificate_types.uniq.sort.join(',') } unless certificate_types.empty?

  certificates = Spaceship::ConnectAPI::Certificate.all(
    filter: filter
  ).select(&:valid?)

  certificates
end

.devices(platform: nil, include_mac_in_profiles: false) ⇒ Object



52
53
54
55
56
57
58
59
# File 'match/lib/match/portal_fetcher.rb', line 52

def self.devices(platform: nil, include_mac_in_profiles: false)
  devices = Spaceship::ConnectAPI::Device.devices_for_platform(
    platform: platform,
    include_mac_in_profiles: include_mac_in_profiles
  )

  devices
end

.profiles(profile_type:, needs_profiles_devices: false, needs_profiles_certificate_content: false, name: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'match/lib/match/portal_fetcher.rb', line 8

def self.profiles(profile_type:, needs_profiles_devices: false, needs_profiles_certificate_content: false, name: nil)
  includes = ['bundleId']

  if needs_profiles_devices
    includes += ['devices', 'certificates']
  end

  if needs_profiles_certificate_content
    includes += ['certificates']
  end

  profiles = Spaceship::ConnectAPI::Profile.all(
    filter: { profileType: profile_type, name: name }.compact,
    includes: includes.uniq.join(',')
  )

  profiles
end