Class: TinyAppstoreConnect::Model::Certificate

Inherits:
Object
  • Object
show all
Includes:
TinyAppstoreConnect::Model
Defined in:
lib/tiny_appstore_connect/models/certificate.rb

Defined Under Namespace

Modules: CertificateType

Instance Attribute Summary collapse

Attributes included from TinyAppstoreConnect::Model

#id, #included, #rate

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TinyAppstoreConnect::Model

included, #initialize, #update_attributes, #update_include

Instance Attribute Details

#certificate_contentObject

Returns the value of attribute certificate_content.



16
17
18
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 16

def certificate_content
  @certificate_content
end

#certificate_typeObject

Returns the value of attribute certificate_type.



11
12
13
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 11

def certificate_type
  @certificate_type
end

#display_nameObject

Returns the value of attribute display_name.



12
13
14
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 12

def display_name
  @display_name
end

#expiratio_dateObject

Returns the value of attribute expiratio_date.



15
16
17
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 15

def expiratio_date
  @expiratio_date
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 10

def name
  @name
end

#platformObject

Returns the value of attribute platform.



14
15
16
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 14

def platform
  @platform
end

#serial_numberObject

Returns the value of attribute serial_number.



13
14
15
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 13

def serial_number
  @serial_number
end

Class Method Details

.typeObject



74
75
76
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 74

def self.type
  'certificates'
end

Instance Method Details

#certificateObject



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 61

def certificate
  @certificate ||= -> () do
    require 'openssl'
    data = [
      '-----BEGIN CERTIFICATE-----',
      certificate_content,
      '-----END CERTIFICATE-----'
    ].join("\n")

    OpenSSL::X509::Certificate.new(data)
  end.call
end

#full_nameObject



41
42
43
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 41

def full_name
  subject['CN']
end

#subjectObject

def type

value = subject['CN']
if value.include?('Distribution')
  return 'Distribution'
else
  return ''
end

end



53
54
55
56
57
58
59
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 53

def subject
  @subject ||= certificate.subject
                          .to_a
                          .each_with_object({}) do |(key, value, _), obj|
                            obj[key] = value.force_encoding('UTF-8')
                          end
end

#team_idObject



33
34
35
# File 'lib/tiny_appstore_connect/models/certificate.rb', line 33

def team_id
  subject['OU']
end