Class: Fog::Compute::Google::Regions

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/compute/google/models/regions.rb

Instance Method Summary collapse

Instance Method Details

#allObject



7
8
9
10
# File 'lib/fog/compute/google/models/regions.rb', line 7

def all
  data = service.list_regions.to_h
  load(data[:items] || [])
end

#get(identity) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/fog/compute/google/models/regions.rb', line 12

def get(identity)
  if identity
    region = service.get_region(identity).to_h
    return new(region)
  end
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  nil
end