Class: DockerCloud::RegionAPI

Inherits:
API
  • Object
show all
Defined in:
lib/docker_cloud/api/region_api.rb

Constant Summary collapse

TYPE =
'Region'.freeze

Constants inherited from API

API::API_VERSION, API::BASE_API_PATH

Instance Attribute Summary

Attributes inherited from API

#client, #headers, #type

Instance Method Summary collapse

Methods inherited from API

#get_from_uri, #http_delete, #http_get, #http_patch, #http_post, #initialize, #parse, #url

Constructor Details

This class inherits a constructor from DockerCloud::API

Instance Method Details

#all(params = {}) ⇒ Object

Lists all regions of all supported cloud providers. Returns a list of Region objects



11
12
13
14
# File 'lib/docker_cloud/api/region_api.rb', line 11

def all(params = {})
  response = http_get(resource_url, params)
  format_object(response, TYPE)
end

#get(provider_name, region_name) ⇒ Object

Gets all the details of a specific region for a specific provider Returns a Region object



18
19
20
21
22
# File 'lib/docker_cloud/api/region_api.rb', line 18

def get(provider_name, region_name)
  provider_region = "#{provider_name}/#{region_name}"
  response = http_get(resource_url(provider_region))
  format_object(response, TYPE)
end

#resource_url(provider_region = '') ⇒ Object



5
6
7
# File 'lib/docker_cloud/api/region_api.rb', line 5

def resource_url(provider_region = '')
  "/region/#{provider_region}"
end