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:,headers:



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

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

Instance Method Details

#json?Boolean

Returns:

  • (Boolean)


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

def json?
  true
end

#requestObject



144
145
146
147
148
149
150
# File 'lib/skn_utils/job_commands.rb', line 144

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

#uriObject



140
141
142
# File 'lib/skn_utils/job_commands.rb', line 140

def uri
  @_uri
end