class Thron::Gateway::Repository

Constants

PACKAGE

Public Class Methods

routes() click to toggle source
# File lib/thron/gateway/repository.rb, line 13
def self.routes
  @routes ||= {
    add_files: Route::factory(name: 'addFilesToPlatform', package: PACKAGE),
    add_s3_resource: Route::factory(name: 'addS3ResourceToPlatform', package: PACKAGE),
    add_web_resource: Route::factory(name: 'addWebResourceToPlatform', package: PACKAGE),
    delete_ftp_file: Route::factory(name: 'deleteFtpFile', package: PACKAGE),
    delete_uploaded_file: Route::factory(name: 'deleteUploadedFile', package: PACKAGE),
    get_ftp_file_list: Route::factory(name: 'getFtpFileList', package: PACKAGE),
    get_quota_usage: Route::factory(name: 'getQuotaUsage', package: PACKAGE, verb: Route::Verbs::GET),
    get_s3_credentials: Route::factory(name: 'getS3UploadCredentials', package: PACKAGE, verb: Route::Verbs::GET),
    get_uploaded_file_list: Route::factory(name: 'getUploadedFileList', package: PACKAGE)
  }
end

Public Instance Methods

add_files(options = {}) click to toggle source
# File lib/thron/gateway/repository.rb, line 27
def add_files(options = {})
  files = options[:files]
  body = { 
    clientId: client_id,
    files: { files: files }
  }
  route(to: __callee__, body: body, token_id: token_id) do |response|
    response.body = Entity::Base::factory(response.body)
  end
end
add_s3_resource(options = {}) click to toggle source
# File lib/thron/gateway/repository.rb, line 38
def add_s3_resource(options = {})
  resource = options[:resource]
  remove_resource = options.fetch(:remove_resource) { false }
  body = { 
    clientId: client_id,
    resource: resource,
    remove_resource_if_possible: remove_resource
  }
  route(to: __callee__, body: body, token_id: token_id) do |response|
    response.body = Entity::Base::factory(response.body)
  end
end
add_web_resource(options = {}) click to toggle source
# File lib/thron/gateway/repository.rb, line 51
def add_web_resource(options = {})
  resource = options[:resource]
  body = { 
    clientId: client_id,
    webResource: resource
  }
  route(to: __callee__, body: body, token_id: token_id) do |response|
    response.body = Entity::Base::factory(response.body)
  end
end
get_quota_usage() click to toggle source
# File lib/thron/gateway/repository.rb, line 92
def get_quota_usage
  query = { 
    clientId: client_id,
  }
  route(to: __callee__, query: query, token_id: token_id) do |response|
    response.body = Entity::Base::factory(response.body)
  end
end
get_s3_credentials() click to toggle source
# File lib/thron/gateway/repository.rb, line 101
def get_s3_credentials
  query = { 
    clientId: client_id,
  }
  route(to: __callee__, query: query, token_id: token_id) do |response|
    response.body = Entity::Base::factory(response.body.fetch('credentials') { {} })
  end
end