2012-07-27 07:06:28 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Brightbox
|
|
|
|
|
|
|
|
class Application < Fog::Model
|
|
|
|
|
|
|
|
identity :id
|
|
|
|
attribute :url
|
|
|
|
attribute :name
|
|
|
|
attribute :secret
|
|
|
|
|
|
|
|
def save
|
2012-12-22 21:45:05 -05:00
|
|
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
2012-07-27 07:06:28 -04:00
|
|
|
options = {
|
|
|
|
:name => name
|
|
|
|
}.delete_if {|k,v| v.nil? || v == "" }
|
2012-12-22 18:29:21 -05:00
|
|
|
data = service.create_application(options)
|
2012-07-27 07:06:28 -04:00
|
|
|
merge_attributes(data)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|