class CfScript::Command::General::ApiCommand
Constants
- API_ENDPOINT_REGEX
- API_NOT_SET
Public Class Methods
new()
click to toggle source
Calls superclass method
CfScript::Command::Base::new
# File lib/cf_script/command/cf/general/api.rb, line 7 def initialize super(:general, :api) end
Public Instance Methods
run(url = nil, &block)
click to toggle source
# File lib/cf_script/command/cf/general/api.rb, line 11 def run(url = nil, &block) run_cf self, url do |output| return unless good_run?(output) if output.contains? API_NOT_SET error API_NOT_SET else build_endpoint(output) end end end
Private Instance Methods
build_endpoint(output)
click to toggle source
# File lib/cf_script/command/cf/general/api.rb, line 25 def build_endpoint(output) attrs = output.line_attributes API_ENDPOINT_REGEX unless attrs.nil? or attrs.empty? CfScript::ApiEndpoint.new( attrs[:url].value, attrs[:version].value ) end end