Sha256: c7aebd4a09587be2278f3a9c3d4ff7e49a6f2d2297c286a188b58413d9aab474
Contents?: true
Size: 1.21 KB
Versions: 31
Compression:
Stored size: 1.21 KB
Contents
class Ey::Core::Client::Address < Ey::Core::Model extend Ey::Core::Associations identity :id, type: :integer attribute :name attribute :ip_address attribute :provisioned_id attribute :location attribute :disappeared_at, type: :time has_one :provider has_one :server def detach params = { "id" => self.identity, } self.connection.requests.new(self.connection.detach_address(params).body["request"]) end def attach(server) params = { "id" => self.identity, "server" => server.identity, } self.connection.requests.new(self.connection.attach_address(params).body["request"]) end def save! if new_record? requires :provider_id, :location params = { "provider" => self.provider_id, "address" => { "location" => self.location, }, } self.connection.requests.new(self.connection.create_address(params).body["request"]) else requires :identity params = { "id" => self.identity, "address" => { "disappeared_at" => self.disappeared_at, } } merge_attributes(self.connection.update_address(params).body["address"]) end end end
Version data entries
31 entries across 31 versions & 1 rubygems