Class: Aspera::Api::Ats

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

Overview

Aspera Transfer Service API client without authentication

Constant Summary collapse

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

Instance Attribute Summary

Attributes inherited from Rest::Client

#auth_params, #base_url, #headers

Instance Method Summary collapse

Methods inherited from Rest::Client

#call, #cancel, #create, #delete, #oauth, #params, #read, #update

Constructor Details

#initialize ⇒ Ats

Returns a new instance of Ats.



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

def initialize
  super(base_url: "#{SERVICE_BASE_URL}/pub/v1")
  # cache of server data
  @all_servers_cache = nil
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



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

def all_servers
  if @all_servers_cache.nil?
    @all_servers_cache = []
    CLOUD_NAME.each_key do |name|
      read("servers/#{name.to_s.upcase}").each do |i|
        @all_servers_cache.push(i)
      end
    end
  end
  return @all_servers_cache
end

#cloud_names ⇒ Object



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

def cloud_names; CLOUD_NAME; end