Class: Tide::API::Response Private

Inherits:
Object
  • Object
show all
Defined in:
lib/tide/api/response.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.

Generic response of a request to Tide’s API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload, error) ⇒ 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.

Instantiates a new API response

Parameters:

  • payload (Hash|Array<Hash>)

    Hash or array of hashes representing each item in the response body.

  • error (Boolean)

    Whether the request failed



19
20
21
22
# File 'lib/tide/api/response.rb', line 19

def initialize(payload, error)
  @payload = payload
  @error = error
end

Instance Attribute Details

#payloadHash|Array<Hash> (readonly)

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.

Hash or array of hashes representing each item in the response body.

Returns:

  • (Hash|Array<Hash>)


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

def payload
  @payload
end

Instance Method Details

#error?Boolean

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.

Whether the response contains errors

Returns:

  • (Boolean)

    true if the response has errors and false otherwise



28
29
30
# File 'lib/tide/api/response.rb', line 28

def error?
  @error
end