class HubClient

Constants

HUB_URL

Attributes

auth_token[R]

Public Class Methods

new(auth_token: nil) click to toggle source
# File lib/makers_toolbelt/hub_client.rb, line 14
def initialize(auth_token: nil)
  @auth_token = auth_token || ENV['HUB_AUTH_TOKEN']
end

Public Instance Methods

post(path:, params:, base_uri: nil) click to toggle source
# File lib/makers_toolbelt/hub_client.rb, line 18
def post(path:, params:, base_uri: nil)
  query = params.merge({"auth_token" => auth_token})
  headers = {'Content-Type' => 'application/json' } 
  self.class.post(uri(base_uri, path), query: query, headers: headers)
end

Private Instance Methods

uri(base_uri, path) click to toggle source
# File lib/makers_toolbelt/hub_client.rb, line 26
def uri(base_uri, path)
  if base_uri.nil? || base_uri.empty? 
    base_uri = HUB_URL
  end
  base_uri + path
end