Sha256: de89be88eb684c2cf69f51309e4bb2b36b1549c5868f3c67e6edfcf565e15e45

Contents?: true

Size: 1004 Bytes

Versions: 26

Compression:

Stored size: 1004 Bytes

Contents

module Loquor
  class HttpAction::Put < HttpAction
    def self.put(url, payload, deps)
      new(url, payload, deps).put
    end

    def initialize(url, payload, deps)
      super(url, deps)
      @payload = payload
    end

    def put
      @config.logger.info "Making put request to: #{full_url}"
      response = JSON.parse(signed_request.execute)
      @config.logger.info "Signed request executed. Response: #{response}"
      Resource.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: :put)
    end

    def full_url
      "#{@config.endpoint}#{@url}"
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
loquor-1.13.0 lib/loquor/http_actions/put.rb
loquor-1.12.0 lib/loquor/http_actions/put.rb
loquor-1.11.0 lib/loquor/http_actions/put.rb
loquor-1.10.0 lib/loquor/http_actions/put.rb
loquor-1.9.0 lib/loquor/http_actions/put.rb
loquor-1.8.0 lib/loquor/http_actions/put.rb
loquor-1.7.0 lib/loquor/http_actions/put.rb
loquor-1.6.0 lib/loquor/http_actions/put.rb
loquor-1.5.0 lib/loquor/http_actions/put.rb
loquor-1.4.0 lib/loquor/http_actions/put.rb
loquor-1.3.0 lib/loquor/http_actions/put.rb
loquor-1.2.1 lib/loquor/http_actions/put.rb
loquor-1.2.0 lib/loquor/http_actions/put.rb
loquor-1.1.1 lib/loquor/http_actions/put.rb
loquor-1.1.0 lib/loquor/http_actions/put.rb
loquor-1.0.0 lib/loquor/http_actions/put.rb
loquor-0.9.0 lib/loquor/http_actions/put.rb
loquor-0.8.0 lib/loquor/http_actions/put.rb
loquor-0.7.0 lib/loquor/http_actions/put.rb
loquor-0.6.0 lib/loquor/http_actions/put.rb