Sha256: cea937cbbf88df5ef3fe0879d41ee0928532ee2c67a3a4318219af32abb04fad

Contents?: true

Size: 966 Bytes

Versions: 4

Compression:

Stored size: 966 Bytes

Contents

require "fog/brightbox/model"

module Fog
  module Compute
    class Brightbox
      class ApiClient < Fog::Brightbox::Model
        identity :id
        attribute :name
        attribute :description
        attribute :secret
        attribute :revoked_at, :type => :time
        attribute :account_id

        def save
          raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
          options = {
            :name => name,
            :description => description
          }.delete_if { |k, v| v.nil? || v == "" }
          data = service.create_api_client(options)
          merge_attributes(data)
          true
        end

        def destroy
          requires :identity
          service.destroy_api_client(identity)
          true
        end

        def reset_secret
          requires :identity
          service.reset_secret_api_client(identity)
          true
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-brightbox-0.3.0 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-0.2.0 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-0.1.1 lib/fog/brightbox/models/compute/api_client.rb
fog-brightbox-0.1.0 lib/fog/brightbox/models/compute/api_client.rb