Class: Tide::API::HTTPClient Private

Inherits:
Object
  • Object
show all
Defined in:
lib/tide/api/http_client.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responsible for the HTTP interactions. The only entity aware of HTTP concerns such as status codes and headers.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

An OAuth2 access token



12
13
14
# File 'lib/tide/api/http_client.rb', line 12

def access_token
  @access_token
end

#refresh_tokenObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

An OAuth2 refresh token



15
16
17
# File 'lib/tide/api/http_client.rb', line 15

def refresh_token
  @refresh_token
end

Instance Method Details

#get(endpoint) ⇒ Response

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Performs a GET request to Tide’s API. Every request returns the status code 200.

Examples:

Retrieving a resource

client = HTTPClient.new
result = client.get('https://api.tide.co/tide-backend/rest/api/v1/oauth2/tokens')

Parameters:

  • endpoint (String)

    URL of the API endpoint of the GET request

Returns:

  • (Response)

    Generic response of a request to Tide’s API



27
28
29
30
31
# File 'lib/tide/api/http_client.rb', line 27

def get(endpoint)
  response = HTTP.headers(headers).get(endpoint)

  Response.new(JSON.parse(response.body), response.status != 200)
end