Class: ApiStruct::Errors::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/api_struct/errors/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
13
14
# File 'lib/api_struct/errors/client.rb', line 6

def initialize(response)
  if response.is_a?(Hash)
    @status = response[:status]
    @body = response[:body]
  else
    @status = response.status
    @body = parse_body(response.body.to_s)
  end
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/api_struct/errors/client.rb', line 4

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/api_struct/errors/client.rb', line 4

def status
  @status
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/api_struct/errors/client.rb', line 16

def to_s
  error
end