Sha256: 30d0c2969f6c488ba2ed0c542cfd479c3aed61c5d22af2545c909ce84cbfb7be
Contents?: true
Size: 1.27 KB
Versions: 8
Compression:
Stored size: 1.27 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 :scope 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, "scope" => self.scope, }, } 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
8 entries across 8 versions & 2 rubygems