Class: Joyent::Datacenters

Inherits:
Object
  • Object
show all
Defined in:
lib/joyent/datacenters.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Datacenters

Returns a new instance of Datacenters.



3
4
5
# File 'lib/joyent/datacenters.rb', line 3

def initialize(connection)
  @connection = connection
end

Class Method Details

.defaultObject



7
8
9
# File 'lib/joyent/datacenters.rb', line 7

def self.default
  Joyent::API_ENDPOINT
end

Instance Method Details

#get(name) ⇒ Object



15
16
17
# File 'lib/joyent/datacenters.rb', line 15

def get(name)
  Joyent::Datacenter.new(name, @connection.execute(:get, "/datacenters")[name])
end

#listObject



11
12
13
# File 'lib/joyent/datacenters.rb', line 11

def list
  @connection.execute(:get, "/datacenters").map{|name, url| Joyent::Datacenter.new(name, url)}
end