Sha256: 451cfd571ffe8502591eaa158afc9f10b2058b86bdf4f6afffac0a3b75761af6

Contents?: true

Size: 853 Bytes

Versions: 11

Compression:

Stored size: 853 Bytes

Contents

module Loquor
  class HttpAction
    def initialize(url, deps)
      @url = url
      @config = deps[:config]
      @should_cache = deps[:should_cache]
    end

    def signed_request
      @config.logger.info "Signing request."
      ApiAuth.sign!(request, @config.access_id, @config.secret_key)
    end

    def execute
      @config.logger.info "Making HTTP request to: #{full_url}"
      signed_request.execute
    rescue RestClient::ResourceNotFound => e
      @config.logger.error("HTTP 404 when accessing #{full_url}")
      raise
    rescue => e
      @config.logger.error("Exception while executing request: #{e.message} <#{e.class}>")
      raise
    end

    private

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

require 'loquor/http_actions/get'
require 'loquor/http_actions/post'
require 'loquor/http_actions/put'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
loquor-1.5.0 lib/loquor/http_action.rb
loquor-1.4.0 lib/loquor/http_action.rb
loquor-1.3.0 lib/loquor/http_action.rb
loquor-1.2.1 lib/loquor/http_action.rb
loquor-1.2.0 lib/loquor/http_action.rb
loquor-1.1.1 lib/loquor/http_action.rb
loquor-1.1.0 lib/loquor/http_action.rb
loquor-1.0.0 lib/loquor/http_action.rb
loquor-0.9.0 lib/loquor/http_action.rb
loquor-0.8.0 lib/loquor/http_action.rb
loquor-0.7.0 lib/loquor/http_action.rb