Class: SknUtils::CommandJSONPost
- Defined in:
- lib/skn_utils/job_commands.rb
Overview
#################################################
Class Method Summary collapse
-
.call(options) ⇒ Object
full_url:,username:,userpass:,payload:,headers:.
Instance Method Summary collapse
Class Method Details
.call(options) ⇒ Object
full_url:,username:,userpass:,payload:,headers:
10 11 12 |
# File 'lib/skn_utils/job_commands.rb', line 10 def self.call() # {full_url:,username:,userpass:,payload:,headers:} new() end |
Instance Method Details
#json? ⇒ Boolean
14 15 16 |
# File 'lib/skn_utils/job_commands.rb', line 14 def json? true end |
#request ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/skn_utils/job_commands.rb', line 22 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/json' req.body = formatted_data req end |
#uri ⇒ Object
18 19 20 |
# File 'lib/skn_utils/job_commands.rb', line 18 def uri @_uri end |