Class: SknUtils::CommandJSONPut

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:



129
130
131
# File 'lib/skn_utils/job_commands.rb', line 129

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

Instance Method Details

#json?Boolean

Returns:

  • (Boolean)


133
134
135
# File 'lib/skn_utils/job_commands.rb', line 133

def json?
  true
end

#requestObject



141
142
143
144
145
146
147
# File 'lib/skn_utils/job_commands.rb', line 141

def request
  req = Net::HTTP::Put.new(uri.path)        # Generate HTTPRequest object
  req.basic_auth(@_username, @_userpass) if credentials?
  req.content_type = 'application/json'
  req.body = formatted_data
  req
end

#uriObject



137
138
139
# File 'lib/skn_utils/job_commands.rb', line 137

def uri
  @_uri
end