Class: CDEKApiClient::Entities::AuthErrorResponse

Inherits:
Object
  • Object
show all
Includes:
Validatable
Defined in:
lib/cdek_api_client/entities/auth_error_response.rb

Overview

Represents an OAuth authentication error response from the CDEK API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validatable

included, #validate!

Constructor Details

#initialize(error:, error_description:) ⇒ AuthErrorResponse

Initializes a new AuthErrorResponse object.

Parameters:

  • error (String)

    the error code.

  • error_description (String)

    the human-readable error description.

Raises:

  • (ArgumentError)

    if any attribute validation fails.



21
22
23
24
25
# File 'lib/cdek_api_client/entities/auth_error_response.rb', line 21

def initialize(error:, error_description:)
  @error = error
  @error_description = error_description
  validate!
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



11
12
13
# File 'lib/cdek_api_client/entities/auth_error_response.rb', line 11

def error
  @error
end

#error_descriptionObject

Returns the value of attribute error_description.



11
12
13
# File 'lib/cdek_api_client/entities/auth_error_response.rb', line 11

def error_description
  @error_description
end

Instance Method Details

#to_json(*_args) ⇒ String

Converts the AuthErrorResponse object to a JSON representation.

Returns:

  • (String)

    the JSON representation of the AuthErrorResponse.



30
31
32
33
34
35
# File 'lib/cdek_api_client/entities/auth_error_response.rb', line 30

def to_json(*_args)
  {
    error: @error,
    error_description: @error_description
  }.to_json
end