Exception: Skylight::Api::CreateFailed Private

Inherits:
StandardError
  • Object
show all
Defined in:
lib/skylight/api.rb

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(res) ⇒ CreateFailed

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



11
12
13
14
# File 'lib/skylight/api.rb', line 11

def initialize(res)
  @res = res
  super "failed with status #{res.status}"
end

Instance Attribute Details

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



9
10
11
# File 'lib/skylight/api.rb', line 9

def res
  @res
end

Instance Method Details

#errorsObject

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.



16
17
18
19
# File 'lib/skylight/api.rb', line 16

def errors
  return unless res.respond_to?(:body) && res.body.is_a?(Hash)
  res.body['errors']
end

#to_sObject

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.



21
22
23
24
25
26
27
28
29
# File 'lib/skylight/api.rb', line 21

def to_s
  if errors
    errors.inspect
  elsif res
    "#{res.class.to_s}: #{res.to_s}"
  else
    super
  end
end