Sha256: 706857c2928c2788d14563bd3f801dea5416f94155cfbe7f8bb53a6a83afdab5
Contents?: true
Size: 1 KB
Versions: 15
Compression:
Stored size: 1 KB
Contents
class Ey::Core::Client::Addon < Ey::Core::Model extend Ey::Core::Associations identity :id, type: :integer attribute :vars attribute :name attribute :sso_url has_one :account has_many :addon_attachments, aliases: ["addon_attachments", "attachments"] alias :attachments :addon_attachments def resource_url "#{collection.url}/#{id}" end def save! params = { "addon" => { "name" => self.name, "vars" => self.vars, "sso_url" => self.sso_url, }, } if new_record? params["url"] = self.collection.url merge_attributes(self.connection.create_addon(params).body["addon"]) else # update params["url"] = self.resource_url merge_attributes(self.connection.update_addon(params).body["addon"]) end end def destroy! self.connection.destroy_addon("url" => self.resource_url) nil end def attach!(key, app, env) self.attachments.create!("key" => key, "app_id" => app.id, "environment_id" => env.id) end end
Version data entries
15 entries across 15 versions & 1 rubygems