class VpsbClient::CurlWrapper

Public Class Methods

new(auth_token) click to toggle source
# File lib/vpsb_client/curl_wrapper.rb, line 5
def initialize(auth_token)
  @auth_token = auth_token
end

Public Instance Methods

get(url) { |curl| ... } click to toggle source
# File lib/vpsb_client/curl_wrapper.rb, line 9
def get(url, &block)
  Curl.get(url) do |curl|
    curl.ssl_verify_host = false
    curl.ssl_verify_peer = false
    curl.headers['Authorization'] = "Token #{@auth_token}"

    yield curl if block_given?
  end
end
post(url, post_params, content_type) { |curl| ... } click to toggle source
# File lib/vpsb_client/curl_wrapper.rb, line 19
def post(url, post_params, content_type, &block)
  Curl.post(url, post_params) do |curl|
    curl.ssl_verify_host = false
    curl.ssl_verify_peer = false
    curl.headers['content-type'] = content_type
    curl.headers['Authorization'] = "Token #{@auth_token}"

    yield curl if block_given?
  end
end
put(url, put_params, content_type) { |curl| ... } click to toggle source
# File lib/vpsb_client/curl_wrapper.rb, line 30
def put(url, put_params, content_type, &block)
  Curl.put(url, put_params) do |curl|
    curl.ssl_verify_host = false
    curl.ssl_verify_peer = false
    curl.headers['content-type'] = content_type
    curl.headers['Authorization'] = "Token #{@auth_token}"

    yield curl if block_given?
  end
end