Class: AppleManifestRails::ManifestController

Inherits:
ApplicationController show all
Defined in:
app/controllers/apple_manifest_rails/manifest_controller.rb

Instance Method Summary collapse

Instance Method Details

#check_installObject

Check install



26
27
28
29
30
# File 'app/controllers/apple_manifest_rails/manifest_controller.rb', line 26

def check_install
  @udid = params[:udid]
  @checker = AppleManifestRails::Install::Checker.new
  set_itms_url if @checker.installable?(@udid)
end

#enrollObject

Enroll (Capture UDID)



6
7
8
# File 'app/controllers/apple_manifest_rails/manifest_controller.rb', line 6

def enroll
  @ios_device = request.user_agent =~ /(Mobile\/.+Safari)/
end

#extract_udidObject



16
17
18
19
20
21
22
23
# File 'app/controllers/apple_manifest_rails/manifest_controller.rb', line 16

def extract_udid
  parser = AppleManifestRails::Enroll::ResponseParser.new(request)
  udid = parser.get 'UDID'
  version = parser.get 'VERSION'
  product = parser.get 'PRODUCT'
  # TODO log this stuff
  redirect_to "#{request.url}/check_install?udid=#{udid}", status: 301
end

#installObject

Install (Send IPA)



33
34
35
36
# File 'app/controllers/apple_manifest_rails/manifest_controller.rb', line 33

def install
  set_itms_url
  render layout:false
end

#manifestObject



38
39
40
41
42
# File 'app/controllers/apple_manifest_rails/manifest_controller.rb', line 38

def manifest
  install = AppleManifestRails::Install::IPA.new(request)
  install.write_manifest
  send_file install.manifest_path
end

#mobileconfigObject



10
11
12
13
14
# File 'app/controllers/apple_manifest_rails/manifest_controller.rb', line 10

def mobileconfig
  enroll = AppleManifestRails::Enroll::MobileConfig.new(request)
  enroll.write_mobileconfig
  send_file enroll.outfile_path, type: enroll.mime_type
end

#send_ipaObject



44
45
46
# File 'app/controllers/apple_manifest_rails/manifest_controller.rb', line 44

def send_ipa
  send_file ipa_path
end