Exception: Files::APIError

Inherits:
Error
  • Object
show all
Defined in:
lib/files.com/errors.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#code, #http_body, #http_headers, #http_status, #json_body, #message, #request_id, #response

Instance Method Summary collapse

Methods inherited from Error

#to_s

Constructor Details

#initialize(message = nil, **kwargs) ⇒ APIError

Returns a new instance of APIError.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/files.com/errors.rb', line 33

def initialize(message = nil, **kwargs)
  @detail = kwargs.dig(:json_body, :detail)
  @error = kwargs.dig(:json_body, :error)
  @errors = kwargs.dig(:json_body, :errors)
  @http_code = kwargs.dig(:json_body, :'http-code')
  @instance = kwargs.dig(:json_body, :instance)
  @model_errors = kwargs.dig(:json_body, :model_errors)
  @title = kwargs.dig(:json_body, :title)
  @type = kwargs.dig(:json_body, :type)
  @data = kwargs.dig(:json_body, :data)

  super(message, **kwargs)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def data
  @data
end

#detailObject (readonly)

Returns the value of attribute detail.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def detail
  @detail
end

#errorObject (readonly)

Returns the value of attribute error.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def error
  @error
end

#errorsObject (readonly)

Returns the value of attribute errors.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def errors
  @errors
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def http_code
  @http_code
end

#instanceObject (readonly)

Returns the value of attribute instance.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def instance
  @instance
end

#model_errorsObject (readonly)

Returns the value of attribute model_errors.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def model_errors
  @model_errors
end

#titleObject (readonly)

Returns the value of attribute title.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



31
32
33
# File 'lib/files.com/errors.rb', line 31

def type
  @type
end