Class: Aspera::Api::Ats

Inherits:
Rest
  • Object
show all
Defined in:
lib/aspera/api/ats.rb

Constant Summary collapse

SERVICE_BASE_URL =
'https://ats.aspera.io'

Constants inherited from Rest

Rest::ENTITY_NOT_FOUND, Rest::JSON_DECODE

Instance Attribute Summary

Attributes inherited from Rest

#auth_params, #base_url

Instance Method Summary collapse

Methods inherited from Rest

array_params, array_params?, basic_token, build_uri, #call, #cancel, #create, decode_query, #delete, io_http_session, #lookup_by_name, #oauth, #params, parse_header, #read, remote_certificate_chain, set_parameters, start_http_session, #update, user_agent

Constructor Details

#initializeAts

Returns a new instance of Ats.



23
24
25
26
27
# File 'lib/aspera/api/ats.rb', line 23

def initialize
  super(base_url: "#{SERVICE_BASE_URL}/pub/v1")
  # cache of server data
  @all_servers_cache = nil
end

Instance Method Details

#all_serversObject

all available ATS servers NOTE to Aspera: an API shall be created to retrieve all servers at once



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/aspera/api/ats.rb', line 33

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_namesObject



29
# File 'lib/aspera/api/ats.rb', line 29

def cloud_names; CLOUD_NAME; end