Sha256: ddb09dbf3ea4a2c96cf371d21e86b98012f5b141c20c3bb08c0757ecbdf5cc37

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 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
      JSON.parse(signed_request.execute)
    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
      full_url = "#{@config.endpoint}#{@url}"
      RestClient::Request.new(url: full_url,
                              accept: :json,
                              payload: @payload.to_json,
                              headers: {'Content-type' => 'application/json'},
                              method: :post)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loquor-0.0.1 lib/loquor/http_actions/post.rb