Class: GdsApi::Router
Overview
require_relative ‘exceptions’
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #add_backend(id, url) ⇒ Object
- #add_redirect_route(path, type, destination, redirect_type = "permanent") ⇒ Object
- #add_route(path, type, backend_id) ⇒ Object
- #delete_backend(id) ⇒ Object
- #delete_route(path, type) ⇒ Object
-
#get_backend(id) ⇒ Object
Backends.
-
#get_route(path, type) ⇒ Object
Routes.
Methods inherited from Base
#adapter_name, #client, #create_client, #get_list!, #initialize, #url_for_slug
Constructor Details
This class inherits a constructor from GdsApi::Base
Instance Method Details
#add_backend(id, url) ⇒ Object
12 13 14 |
# File 'lib/gds_api/router.rb', line 12 def add_backend(id, url) put_json!("#{endpoint}/backends/#{CGI.escape(id)}", :backend => {:backend_url => url}) end |
#add_redirect_route(path, type, destination, redirect_type = "permanent") ⇒ Object
30 31 32 33 |
# File 'lib/gds_api/router.rb', line 30 def add_redirect_route(path, type, destination, redirect_type = "permanent") put_json!("#{endpoint}/routes", :route => {:incoming_path => path, :route_type => type, :handler => "redirect", :redirect_to => destination, :redirect_type => redirect_type}) end |
#add_route(path, type, backend_id) ⇒ Object
26 27 28 |
# File 'lib/gds_api/router.rb', line 26 def add_route(path, type, backend_id) put_json!("#{endpoint}/routes", :route => {:incoming_path => path, :route_type => type, :handler => "backend", :backend_id => backend_id}) end |
#delete_backend(id) ⇒ Object
16 17 18 |
# File 'lib/gds_api/router.rb', line 16 def delete_backend(id) delete_json!("#{endpoint}/backends/#{CGI.escape(id)}") end |
#delete_route(path, type) ⇒ Object
35 36 37 |
# File 'lib/gds_api/router.rb', line 35 def delete_route(path, type) delete_json!("#{endpoint}/routes?incoming_path=#{CGI.escape(path)}&route_type=#{CGI.escape(type)}") end |
#get_backend(id) ⇒ Object
Backends
8 9 10 |
# File 'lib/gds_api/router.rb', line 8 def get_backend(id) get_json("#{endpoint}/backends/#{CGI.escape(id)}") end |
#get_route(path, type) ⇒ Object
Routes
22 23 24 |
# File 'lib/gds_api/router.rb', line 22 def get_route(path, type) get_json("#{endpoint}/routes?incoming_path=#{CGI.escape(path)}&route_type=#{CGI.escape(type)}") end |