class AkamaiCCU::Endpoint
Constants
- BASE_PATH
- SHEBANG
Attributes
action[R]
mode[R]
network[R]
Public Class Methods
by_constants(network_const, action_const, mode_const)
click to toggle source
# File lib/akamai_ccu/endpoint.rb, line 24 def self.by_constants(network_const, action_const, mode_const) network = Network.const_get(network_const) action = Action.const_get(action_const) mode = Mode.const_get(mode_const) new(network, action, mode) end
by_name(name)
click to toggle source
# File lib/akamai_ccu/endpoint.rb, line 31 def self.by_name(name) network = name.delete!(SHEBANG) ? Network::PRODUCTION : Network::STAGING tokens = name.split("_") tokens.delete("by") action, mode = tokens new(network, action, mode) end
new(network, action, mode)
click to toggle source
# File lib/akamai_ccu/endpoint.rb, line 41 def initialize(network, action, mode) @network = network @action = action @mode = mode end
Public Instance Methods
path()
click to toggle source
# File lib/akamai_ccu/endpoint.rb, line 51 def path File.join(BASE_PATH, @action, @mode, @network) end
to_s()
click to toggle source
# File lib/akamai_ccu/endpoint.rb, line 47 def to_s "#{@action}_by_#{@mode}#{shebang}" end
Private Instance Methods
production?()
click to toggle source
# File lib/akamai_ccu/endpoint.rb, line 55 def production? @network == Network::PRODUCTION end
shebang()
click to toggle source
# File lib/akamai_ccu/endpoint.rb, line 59 def shebang SHEBANG if production? end