Class: Aspera::AtsApi
Constant Summary
Constants inherited from Rest
Instance Attribute Summary
Attributes inherited from Rest
Class Method Summary collapse
Instance Method Summary collapse
-
#all_servers ⇒ Object
all available ATS servers NOTE to Aspera: an API shall be created to retrieve all servers at once.
- #cloud_names ⇒ Object
-
#initialize ⇒ AtsApi
constructor
A new instance of AtsApi.
Methods inherited from Rest
array_params, basic_creds, #build_request, build_uri, #call, #cancel, #create, #delete, #lookup_by_name, #oauth, #oauth_token, #read, start_http_session, #update
Constructor Details
#initialize ⇒ AtsApi
Returns a new instance of AtsApi.
25 26 27 28 29 |
# File 'lib/aspera/ats_api.rb', line 25 def initialize super({base_url: AtsApi.base_url + '/pub/v1'}) # cache of server data @all_servers_cache = nil end |
Class Method Details
.base_url ⇒ Object
22 |
# File 'lib/aspera/ats_api.rb', line 22 def base_url; 'https://ats.aspera.io'; end |
Instance Method Details
#all_servers ⇒ Object
all available ATS servers NOTE to Aspera: an API shall be created to retrieve all servers at once
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/aspera/ats_api.rb', line 35 def all_servers if @all_servers_cache.nil? @all_servers_cache = [] CLOUD_NAME.each_key do |name| read("servers/#{name.to_s.upcase}")[:data].each do |i| @all_servers_cache.push(i) end end end return @all_servers_cache end |
#cloud_names ⇒ Object
31 |
# File 'lib/aspera/ats_api.rb', line 31 def cloud_names; CLOUD_NAME; end |