Class: SknUtils::CommandFORMPost

Inherits:
Object
  • Object
show all
Defined in:
lib/skn_utils/job_commands.rb

Overview

#################################################

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(options) ⇒ Object

full_url:,username:,userpass:,payload:,headers:



53
54
55
# File 'lib/skn_utils/job_commands.rb', line 53

def self.call(options)  # {full_url:,username:,userpass:,payload:,headers:}
  new(options)
end

Instance Method Details

#json?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/skn_utils/job_commands.rb', line 57

def json?
  false
end

#requestObject



65
66
67
68
69
70
71
# File 'lib/skn_utils/job_commands.rb', line 65

def request
  req = @_headers.nil? ? Net::HTTP::Post.new(uri.path) : Net::HTTP::Post.new(uri.path, @_headers)        # Generate HTTPRequest object
  req.basic_auth(@_username, @_userpass) if credentials?
  req.content_type = 'application/x-www-form-urlencoded'
  req.set_form_data(formatted_data)
  req
end

#uriObject



61
62
63
# File 'lib/skn_utils/job_commands.rb', line 61

def uri
  @_uri
end