class SknUtils::CommandJSONGet
Public Class Methods
call(options)
click to toggle source
# File lib/skn_utils/job_commands.rb, line 137 def self.call(options) # {full_url:,username:,userpass:,headers:} new(options) end
new(opts={})
click to toggle source
# File lib/skn_utils/job_commands.rb, line 157 def initialize(opts={}) @_username = opts[:username] @_userpass = opts[:userpass] @_headers = opts[:headers] @_uri = URI.parse( opts[:full_url]) end
Public Instance Methods
json?()
click to toggle source
# File lib/skn_utils/job_commands.rb, line 141 def json? true end
request()
click to toggle source
# File lib/skn_utils/job_commands.rb, line 149 def request req = @_headers.nil? ? Net::HTTP::Get.new(uri.request_uri) : Net::HTTP::Get.new(uri.request_uri, @_headers) # Generate HTTPRequest object req.basic_auth(@_username, @_userpass) if credentials? req end
uri()
click to toggle source
# File lib/skn_utils/job_commands.rb, line 145 def uri @_uri end
Private Instance Methods
credentials?()
click to toggle source
# File lib/skn_utils/job_commands.rb, line 164 def credentials? !(@_username.nil? || @_userpass.nil?) end