class FFWD::Plugin::GoogleCloud::DebugRequest

Public Class Methods

new(url, params={}) click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 404
def initialize url, params={}
  @url = url
  @response = JSON.dump(params[:response] || {})
  @responses = Hash[(params[:responses] || {}).map{|k, v| [k, JSON.dump(v)]}]
end

Public Instance Methods

close() click to toggle source

do nothing

# File lib/ffwd/plugin/google_cloud/hook.rb, line 419
def close; end
get(params={}) click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 414
def get params={}
  log_request :get, params
end
post(params={}) click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 410
def post params={}
  log_request :post, params
end

Private Instance Methods

log_request(method, params) click to toggle source
# File lib/ffwd/plugin/google_cloud/hook.rb, line 423
def log_request method, params
  path = params.delete(:path) || ""
  body = params.delete(:body)
  log.debug "#{method} #{@url}#{path}: #{params}"
  puts JSON.pretty_generate(JSON.load(body || "{}")) if body
  Callback.new(@responses[[method, path]] || @response)
end