Class: TCCE::File

Inherits:
Object
  • Object
show all
Defined in:
lib/tcce/file.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jsonObject

Returns the value of attribute json.



6
7
8
# File 'lib/tcce/file.rb', line 6

def json
  @json
end

Class Method Details

.parse(content) ⇒ TCCE::File

Parse a file given by argument

Parameters:

  • content (String)

    the object contents

Returns:



15
16
17
18
19
# File 'lib/tcce/file.rb', line 15

def self.parse(content)
  file = TCCE::File.new
  file.json = JSON.parse content
  file
end

Instance Method Details

#certificatesObject



33
34
35
36
37
38
39
40
41
# File 'lib/tcce/file.rb', line 33

def certificates
  certs = []
  json['DomainsCertificate']['Certs'].each do |cert|
    certificate = TCCE::Certificate.parse cert
    certs << certificate
    yield certificate if block_given?
  end
  certs
end

#emailObject



21
22
23
# File 'lib/tcce/file.rb', line 21

def email
  json['Email']
end

#http_challengeObject



43
44
45
# File 'lib/tcce/file.rb', line 43

def http_challenge
  json['HTTPChallenge']
end

#private_keyObject



29
30
31
# File 'lib/tcce/file.rb', line 29

def private_key
  json['PrivateKey']
end

#registrationObject



25
26
27
# File 'lib/tcce/file.rb', line 25

def registration
  TCCE::Registration.parse json['Registration']
end