Sha256: 6004dee3f420be8b40d1764d1c4eddb64d990ad2eee4b9c8e15af00c47f2b05d

Contents?: true

Size: 961 Bytes

Versions: 54

Compression:

Stored size: 961 Bytes

Contents

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

  identity :id

  attribute :username
  attribute :access_id
  attribute :secret_key
  attribute :provisioned_id

  attribute :created_at, type: :time
  attribute :deleted_at, type: :time

  has_one :storage

  attr_accessor :permissions

  def save!
    requires :storage_id, :username

    params = {
        "url"          => self.collection.url,
        "storage"      => self.storage_id,
        "storage_user" => {
          "username"    => self.username,
          "permissions" => self.permissions
        },
    }

    if new_record?
      self.connection.requests.new(self.connection.create_storage_user(params).body["request"])
    else raise NotImplementedError
    end
  end

  def destroy!
    requires :identity

    params = {
      "id" => self.identity,
    }
    connection.requests.new(connection.destroy_storage_user(params).body["request"])
  end
end

Version data entries

54 entries across 54 versions & 3 rubygems

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