Class: HubClient
- Inherits:
-
Object
- Object
- HubClient
- Includes:
- HTTParty
- Defined in:
- lib/makers_toolbelt/hub_client.rb
Constant Summary collapse
- HUB_URL =
"https://hub.makersacademy.com"
Instance Method Summary collapse
-
#initialize(auth_token: nil) ⇒ HubClient
constructor
A new instance of HubClient.
- #post(path:, params:, base_uri: nil) ⇒ Object
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 |