Class: Hcloud::DatacenterResource

Inherits:
AbstractResource show all
Defined in:
lib/hcloud/datacenter_resource.rb

Instance Attribute Summary

Attributes inherited from AbstractResource

#client

Instance Method Summary collapse

Methods inherited from AbstractResource

#all, bind_to, #each, filter_attributes, #find, #find_by, #initialize, #limit, #order, #page, #pagination, #per_page, resource, resource_class, resource_path, resource_url, #run, #where

Constructor Details

This class inherits a constructor from Hcloud::AbstractResource

Instance Method Details

#[](arg) ⇒ Object



13
14
15
16
17
18
# File 'lib/hcloud/datacenter_resource.rb', line 13

def [](arg)
  case arg
  when Integer then find_by(id: arg)
  when String then find_by(name: arg)
  end
end


9
10
11
# File 'lib/hcloud/datacenter_resource.rb', line 9

def recommended
  all.first
end