1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/brightbox/models/compute/api_client.rb
Paul Thornthwaite 77d8b11015 [Brightbox] Code style clean up
First pass at cleaning up the code to a better, more consistent style.
2013-11-27 17:16:07 +00:00

37 lines
924 B
Ruby

module Fog
module Compute
class Brightbox
class ApiClient < Fog::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