Class: Ey::Core::Client::StorageUser

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/storage_user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Associations

assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader

Methods inherited from Model

#destroy, range_parser, #save, #to_s, #update!, #url

Instance Attribute Details

#permissionsObject

Returns the value of attribute permissions.



16
17
18
# File 'lib/ey-core/models/storage_user.rb', line 16

def permissions
  @permissions
end

Instance Method Details

#destroy!Object



36
37
38
39
40
41
42
43
# File 'lib/ey-core/models/storage_user.rb', line 36

def destroy!
  requires :identity

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

#save!Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ey-core/models/storage_user.rb', line 18

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