Sha256: 8686e626b6df81988c919340d86d792f91d8efe9d1e59b3668431369f3acdca3
Contents?: true
Size: 1015 Bytes
Versions: 2
Compression:
Stored size: 1015 Bytes
Contents
module Loquor class HttpAction::Post < HttpAction def self.post(url, payload, deps) new(url, payload, deps).post end def initialize(url, payload, deps) super(url, deps) @payload = payload end def post @config.logger.info "Making POST request to: #{full_url}" response = JSON.parse(signed_request.execute) @config.logger.info "Signed request executed. Response: #{response}" Representation.new(response) end private def signed_request signed_request = super p signed_request # If you take this line out - it all breaks. Yeah... signed_request end def request RestClient::Request.new(url: full_url, accept: :json, payload: @payload.to_json, headers: {'Content-type' => 'application/json'}, method: :post) end def full_url "#{@config.endpoint}#{@url}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
loquor-0.2.0 | lib/loquor/http_actions/post.rb |
loquor-0.1.2 | lib/loquor/http_actions/post.rb |