Class: CloudParty::Nodes::Zones

Inherits:
Object
  • Object
show all
Includes:
Context, HTTParty
Defined in:
lib/cloud_party/nodes/zones.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Context

included

Constructor Details

#initialize(options = {}) ⇒ Zones

Returns a new instance of Zones.



30
31
32
33
# File 'lib/cloud_party/nodes/zones.rb', line 30

def initialize(options = {})
  super()
  @options = options
end

Class Method Details

.set_id_by_name(zone) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cloud_party/nodes/zones.rb', line 16

def self.set_id_by_name(zone)
  options = {
      match: 'all',
      name: zone,
      order: 'name'
  }
  if @options.nil?
    @options = options
  else
    @options.merge!(options)
  end

  @@zone = CloudParty::Responses::Zones.new(:get, '/zones', get('/zones', query: @options), @options).result.first.fetch(:id, nil)
end

Instance Method Details

#delete(id) ⇒ Object



38
39
40
# File 'lib/cloud_party/nodes/zones.rb', line 38

def delete(id)
  CloudParty::Responses::Zones.new(:delete, '/zones/:id', self.class.delete(""))
end

#get(id) ⇒ Object



41
42
43
# File 'lib/cloud_party/nodes/zones.rb', line 41

def get(id)
  CloudParty::Responses::Zones.new(:get, '/zones/:id', self.class.get("/zones/#{id}"), @options)
end

#list_zonesObject



35
36
37
# File 'lib/cloud_party/nodes/zones.rb', line 35

def list_zones
  CloudParty::Responses::Zones.new(:get, '/zones', self.class.get('/zones'), @options)
end