Class: Fugle::HTTP::Error Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
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

Defined Under Namespace

Classes: Body

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api, body) ⇒ Error

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 Error.

Since:

  • 0.1.0



20
21
22
23
24
# File 'lib/fugle/http/error.rb', line 20

def initialize(api, body)
  @api = api
  @version = body['apiVersion']
  @body = Body.new(body['error'])
end

Instance Attribute Details

#bodyObject (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



16
17
18
# File 'lib/fugle/http/error.rb', line 16

def body
  @body
end

#infoObject (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



16
17
18
# File 'lib/fugle/http/error.rb', line 16

def info
  @info
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



32
33
34
35
36
37
# File 'lib/fugle/http/error.rb', line 32

def to_h
  {
    version: @version,
    body: @body
  }
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



45
46
47
# File 'lib/fugle/http/error.rb', line 45

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