Sha256: 0e13ac6acdacea3c24316092cd30bc0a7ebef2b23696646c0f7dbba82060f5e0

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

class Ey::Core::Client::SslCertificate < Ey::Core::Model
  extend Ey::Core::Associations

  identity :id

  attribute :created_at, type: :time
  attribute :deleted_at, type: :time

  attribute :name
  attribute :public_certificate
  attribute :private_key
  attribute :certificate_chain
  attribute :self_signed

  has_one :account

  attr_accessor :self_sign

  def save!
    params = {
      "url"             => self.collection.url,
      "account"         => self.account_id,
      "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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ey-core-3.6.6 lib/ey-core/models/ssl_certificate.rb
ey-core-3.4.5 lib/ey-core/models/ssl_certificate.rb
ey-core-3.6.5 lib/ey-core/models/ssl_certificate.rb