Class: Fastlane::Helper::Certificate

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/push_cert_alert/helper/certificate_helper.rb

Class Method Summary collapse

Class Method Details

.certificate(params) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/fastlane/plugin/push_cert_alert/helper/certificate_helper.rb', line 6

def self.certificate(params)
  if params[:development]
    Spaceship.certificate.development_push
  elsif params[:website_push]
    Spaceship.certificate.website_push
  else
    Spaceship.certificate.production_push
  end
end

.certificate_sorted(params) ⇒ Object



26
27
28
# File 'lib/fastlane/plugin/push_cert_alert/helper/certificate_helper.rb', line 26

def self.certificate_sorted(params)
  certificate(params).all.sort { |x, y| y.expires <=> x.expires }
end

.certificate_type(params) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/fastlane/plugin/push_cert_alert/helper/certificate_helper.rb', line 16

def self.certificate_type(params)
  if params[:development]
    'development'
  elsif params[:website_push]
    'website'
  else
    'production'
  end
end

.existing_certificate(params) ⇒ Object



30
31
32
33
34
# File 'lib/fastlane/plugin/push_cert_alert/helper/certificate_helper.rb', line 30

def self.existing_certificate(params)
  certificate_sorted(params).detect do |c|
    c.owner_name == params[:app_identifier]
  end
end

.remaining_days(certificate) ⇒ Object



36
37
38
# File 'lib/fastlane/plugin/push_cert_alert/helper/certificate_helper.rb', line 36

def self.remaining_days(certificate)
  ((certificate.expires - Time.now) / 60 / 60 / 24).round(2)
end