Class: Ey::Core::Client::Storage

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

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 Method Details

#destroy!Object



35
36
37
# File 'lib/ey-core/models/storage.rb', line 35

def destroy!
  connection.requests.new(connection.destroy_storage(id).body["request"])
end

#save!Object



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

def save!
  requires :provider_id, :name, :location

  params = {
      "url" => self.collection.url,
      "provider" => self.provider_id,
      "storage" => {
        "location" => self.location,
        "name" => self.name
      },
  }

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