Class: HubClient

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/makers_toolbelt/hub_client.rb

Constant Summary collapse

HUB_URL =
"https://hub.makersacademy.com"

Instance Method Summary collapse

Constructor Details

#initialize(auth_token: nil) ⇒ HubClient

Returns a new instance of HubClient.



14
15
16
# File 'lib/makers_toolbelt/hub_client.rb', line 14

def initialize(auth_token: nil)
  @auth_token = auth_token || ENV['HUB_AUTH_TOKEN']
end

Instance Method Details

#post(path:, params:, base_uri: nil) ⇒ Object



18
19
20
21
22
# 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