module Nylas::ApiOperations::Get

Performs a GET call to the Nylas API.

Protected Instance Methods

get(path:, query_params: {}) click to toggle source

Performs a GET call to the Nylas API for a single item response.

@param path [String] Destination path for the call. @param query_params [Hash, {}] Query params to pass to the call. @return [Array([Hash, Array], String)] Nylas data object and API Request ID.

# File lib/nylas/handler/api_operations.rb, line 19
def get(path:, query_params: {})
  response = get_raw(path: path, query_params: query_params)

  [response[:data], response[:request_id]]
end
get_list(path:, query_params: {}) click to toggle source

Performs a GET call to the Nylas API for a list response.

@param path [String] Destination path for the call. @param query_params [Hash, {}] Query params to pass to the call. @return [Array(Array(Hash), String, String)] Nylas data array, API Request ID, and next cursor.

# File lib/nylas/handler/api_operations.rb, line 30
def get_list(path:, query_params: {})
  response = get_raw(path: path, query_params: query_params)

  [response[:data], response[:request_id], response[:next_cursor]]
end

Private Instance Methods

get_raw(path:, query_params: {}) click to toggle source

Performs a GET call to the Nylas API.

@param path [String] Destination path for the call. @param query_params [Hash, {}] Query params to pass to the call. @return [Hash] The JSON response from the Nylas API.

# File lib/nylas/handler/api_operations.rb, line 43
def get_raw(path:, query_params: {})
  execute(
    method: :get,
    path: path,
    query: query_params,
    payload: nil,
    api_key: api_key,
    timeout: timeout
  )
end