Class: Ey::Core::Client::SslCertificate

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/ssl_certificate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Associations

assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader

Methods inherited from Model

#destroy, range_parser, #save, #to_s, #update!, #url

Instance Attribute Details

#self_signObject

Returns the value of attribute self_sign.



17
18
19
# File 'lib/ey-core/models/ssl_certificate.rb', line 17

def self_sign
  @self_sign
end

Instance Method Details

#destroy!Object



41
42
43
# File 'lib/ey-core/models/ssl_certificate.rb', line 41

def destroy!
  self.connection.destroy_ssl_certificate("id" => self.id)
end

#save!Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ey-core/models/ssl_certificate.rb', line 19

def save!
  params = {
    "url"             => self.collection.url,
    "account"         => self.,
    "ssl_certificate" => {
      "name"               => self.name,
      "public_certificate" => self.public_certificate,
      "private_key"        => self.private_key,
      "certificate_chain"  => self.certificate_chain,
    }
  }

  params["ssl_certificate"].merge!("self_sign" => self.self_sign.nil? ? self.self_signed : self.self_sign) if new_record?

  if new_record?
    connection.requests.new(self.connection.create_ssl_certificate(params).body["request"])
  else
    params["id"] = self.id
    self.connection.update_ssl_certificate(params).body["request"]
  end
end