lib/hcloud/location_resource.rb in hcloud-0.1.0.pre.alpha4 vs lib/hcloud/location_resource.rb in hcloud-0.1.0
- old
+ new
@@ -1,11 +1,10 @@
module Hcloud
class LocationResource < AbstractResource
- include Enumerable
-
def all
- j = Oj.load(request("locations").run.body)
- j["locations"].map{|x| Location.new(x, self, client) }
+ mj("locations") do |j|
+ j.flat_map{|x| x["locations"].map{ |x| Location.new(x, self, client) } }
+ end
end
def find(id)
Location.new(
Oj.load(request("locations/#{id}").run.body)["location"],