Sha256: 0eb11b26132e3866f8205d4e136e6eda78303a8a72a096b0a17ac04ccdfdb383
Contents?: true
Size: 1000 Bytes
Versions: 2
Compression:
Stored size: 1000 Bytes
Contents
# encoding: utf-8 require 'active_support/core_ext' require 'multi_json' module Validic module Request def extract_params(params) Validic.organization_id = params.delete(:organization_id) if params[:organization_id] Validic.user_id = params.delete(:user_id) if params[:user_id] params end def get(path, options) request(:get, path, options) end def post(path, options) request(:post, path, options) end def put(path, options) request(:put, path, options) end def request(method, path, options) options[:access_token] = options[:access_token].nil? ? Validic.access_token : options[:access_token] response = connection.send(method) do |request| case method when :get request.url(path, options) when :post, :put request.path = path request.body = MultiJson.encode(options) unless options.empty? end end response.body end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validic-0.3.2 | lib/validic/request.rb |
validic-0.3.1 | lib/validic/request.rb |