Class: Fugle::HTTP::Error::Body Private

Inherits:
Object
  • Object
show all
Defined in:
lib/fugle/http/error.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.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ Body

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.

Returns a new instance of Body.

Since:

  • 0.1.0



58
59
60
61
# File 'lib/fugle/http/error.rb', line 58

def initialize(error)
  @code = error['code']
  @message = error['message']
end

Instance Attribute Details

#codeObject (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.

Since:

  • 0.1.0



54
55
56
# File 'lib/fugle/http/error.rb', line 54

def code
  @code
end

#messageObject (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.

Since:

  • 0.1.0



54
55
56
# File 'lib/fugle/http/error.rb', line 54

def message
  @message
end

Instance Method Details

#to_hHash

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.

Convert to Hash

Returns:

  • (Hash)

    the response as hash

Since:

  • 0.1.0



69
70
71
72
73
74
# File 'lib/fugle/http/error.rb', line 69

def to_h
  {
    code: @code,
    message: @message
  }
end

#to_json(*args) ⇒ String

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.

Convert to JSON

Returns:

  • (String)

    the json string

Since:

  • 0.1.0



82
83
84
# File 'lib/fugle/http/error.rb', line 82

def to_json(*args)
  to_h.to_json(*args)
end