class Bcnd::QuayIo::Connection
Constants
- BASE_URL
Attributes
token[RW]
Public Class Methods
new(token)
click to toggle source
# File lib/bcnd/quay_io.rb, line 10 def initialize(token) @token = token end
Public Instance Methods
delete(path:, body: {}, query_params: {})
click to toggle source
# File lib/bcnd/quay_io.rb, line 40 def delete(path:, body: {}, query_params: {}) request(method: :delete, path: path, body: body, query_params: query_params) end
get(path:, body: {}, query_params: {})
click to toggle source
# File lib/bcnd/quay_io.rb, line 28 def get(path:, body: {}, query_params: {}) request(method: :get, path: path, body: body, query_params: query_params) end
post(path:, body: {}, query_params: {})
click to toggle source
# File lib/bcnd/quay_io.rb, line 36 def post(path:, body: {}, query_params: {}) request(method: :post, path: path, body: body, query_params: query_params) end
put(path:, body: {}, query_params: {})
click to toggle source
# File lib/bcnd/quay_io.rb, line 32 def put(path:, body: {}, query_params: {}) request(method: :put, path: path, body: body, query_params: query_params) end
request(method: :get, path:, body: {}, query_params: {})
click to toggle source
# File lib/bcnd/quay_io.rb, line 14 def request(method: :get, path:, body: {}, query_params: {}) response = RestClient::Request.execute( method: method, url: "#{BASE_URL}#{path}", payload: body.empty? ? nil : body.to_json, headers: { "Authorization" => "Bearer #{token}", "Content-Type" => "application/json", params: query_params } ) JSON.load(response.to_s) end