Sha256: ebee7c2ebeed73e274d47d68221582e348f3166bf1e3a2ada5e4eea8fa1bdf3e
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ey-core-3.6.6 | lib/ey-core/models/address.rb |
ey-core-3.6.5 | lib/ey-core/models/address.rb |