Class: Hcloud::LocationResource
- Inherits:
-
AbstractResource
- Object
- AbstractResource
- Hcloud::LocationResource
- Defined in:
- lib/hcloud/location_resource.rb
Instance Attribute Summary
Attributes inherited from AbstractResource
Instance Method Summary collapse
Methods inherited from AbstractResource
#each, #initialize, #limit, #mj, #order, #page, #per_page
Constructor Details
This class inherits a constructor from Hcloud::AbstractResource
Instance Method Details
#[](arg) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hcloud/location_resource.rb', line 25 def [](arg) case arg when Integer begin find(arg) rescue Error::NotFound end when String find_by(name: arg) end end |
#all ⇒ Object
3 4 5 6 7 |
# File 'lib/hcloud/location_resource.rb', line 3 def all mj("locations") do |j| j.flat_map{|x| x["locations"].map{ |x| Location.new(x, self, client) } } end end |