Class: Joyent::Datacenters
- Inherits:
-
Object
- Object
- Joyent::Datacenters
- Defined in:
- lib/joyent/datacenters.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get(name) ⇒ Object
-
#initialize(connection) ⇒ Datacenters
constructor
A new instance of Datacenters.
- #list ⇒ Object
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
.default ⇒ Object
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 |
#list ⇒ Object
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 |