class Gleis::Domain
The class implements the methods required to manage the domain names of a gleis app
Public Class Methods
add(app_name, name)
click to toggle source
# File lib/gleis/domain.rb, line 4 def self.add(app_name, name) token = Token.check body = API.request('post', 'domains', token, 'name': app_name, 'domain': name) if body['success'] == 1 puts "Successfully added domain to #{app_name}." else puts "Failed to add domain: #{body['message']}" end end
list(app_name)
click to toggle source
# File lib/gleis/domain.rb, line 14 def self.list(app_name) token = Token.check body = API.request('get', "domains/#{app_name}", token) puts "Your app is available under the URL: https://#{body['fqdn']}\n\n" domains = body ['data'] if domains.any? puts "Domain list for #{app_name}:\n\n" domains.each do |domain| puts "\t#{domain['name']}" end else puts 'No domains defined yet.' end end
remove(app_name, name)
click to toggle source
# File lib/gleis/domain.rb, line 29 def self.remove(app_name, name) token = Token.check body = API.request('delete', "domains/#{app_name}/#{name}", token) if body['success'] == 1 puts "Successfully removed domain name from #{app_name}." else puts "Failed to remove domain name: #{body['message']}" end end