Sha256: a0cc792d3665cfbf24b5ffa901f74c4cf6b1249aebeaad9ca8717c06e9ad8bfb

Contents?: true

Size: 1.33 KB

Versions: 54

Compression:

Stored size: 1.33 KB

Contents

class Ey::Core::Client::UntrackedServer < Ey::Core::Model
  extend Ey::Core::Associations

  identity :id, type: :integer

  attribute :provisioned_id
  attribute :provisioner_id
  attribute :location
  attribute :state
  attribute :created_at, type: :time
  attribute :updated_at, type: :time

  has_one :provider

  def save!
    request_attributes = {
      "provider" => self.provider_id,
      "url"      => self.collection.url,
    }

    response = if new_record?
                 requires :location, :provisioned_id

                 request_attributes.merge!(
                   "untracked_server" => Cistern::Hash.slice(
                     Cistern::Hash.stringify_keys(self.attributes), "location", "provisioned_id", "provisioner_id", "state"
                   ),
                 )

                 connection.create_untracked_server(request_attributes)
               else
                 requires :identity

                 request_attributes.merge!(
                   "untracked_server" => Cistern::Hash.slice(
                     Cistern::Hash.stringify_keys(self.attributes), "location", "provisioner_id", "state"
                   ),
                 )

                 connection.update_untracked_server(request_attributes.merge("id" => self.identity))
               end

    merge_attributes(response.body["untracked_server"])
  end
end

Version data entries

54 entries across 54 versions & 3 rubygems

Version Path
ey-core-3.6.0.autoscaling1 lib/ey-core/models/untracked_server.rb
ey-core-3.6.4 lib/ey-core/models/untracked_server.rb
ey-core-3.6.3 lib/ey-core/models/untracked_server.rb
ey-core-3.6.1 lib/ey-core/models/untracked_server.rb
groove-ey-core-3.6.3 lib/ey-core/models/untracked_server.rb
groove-ey-core-3.6.2 lib/ey-core/models/untracked_server.rb
groove-ey-core-3.6.1 lib/ey-core/models/untracked_server.rb
ey-core-3.5.0 lib/ey-core/models/untracked_server.rb
ey-core-3.4.4 lib/ey-core/models/untracked_server.rb
ey-core-3.4.2 lib/ey-core/models/untracked_server.rb
ey-core-3.4.1 lib/ey-core/models/untracked_server.rb
ey-core-3.4.0 lib/ey-core/models/untracked_server.rb
ey-core-3.3.1 lib/ey-core/models/untracked_server.rb
ey-core-3.3.0 lib/ey-core/models/untracked_server.rb
ey-core-3.2.6 lib/ey-core/models/untracked_server.rb
ey-core-3.2.5 lib/ey-core/models/untracked_server.rb
ey-core-3.2.4 lib/ey-core/models/untracked_server.rb
ey-core-3.2.3 lib/ey-core/models/untracked_server.rb
ey-core-3.2.2 lib/ey-core/models/untracked_server.rb
ey-core-3.2.1 lib/ey-core/models/untracked_server.rb