Class: Fog::Compute::Packet::License

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/packet/models/license.rb

Overview

License Model

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ License

Returns a new instance of License.



17
18
19
# File 'lib/fog/compute/packet/models/license.rb', line 17

def initialize(attributes = {})
  super
end

Instance Method Details

#destroyObject



46
47
48
49
50
51
# File 'lib/fog/compute/packet/models/license.rb', line 46

def destroy
  requires :id

  response = service.delete_license(id)
  true if response.status == 204
end

#saveObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/compute/packet/models/license.rb', line 21

def save
  requires :project_id, :description, :size

  options = {
    :description => description,
    :size => size
  }

  options[:license_product_id] = license_product_id if license_product_id

  response = service.create_license(project_id, options)
  merge_attributes(response.body) if response.status == 201
end

#updateObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/compute/packet/models/license.rb', line 35

def update
  requires :id
  options = {
    :description => description,
    :size => size
  }

  response = service.update_license(id, options)
  merge_attributes(response.body) if response.status == 200
end