Class: CloudParty::Responses::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud_party/responses/ips.rb,
lib/cloud_party/responses/zones.rb,
lib/cloud_party/responses/accounts.rb,
lib/cloud_party/responses/dns_records.rb,
lib/cloud_party/responses/memberships.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ Error

Returns a new instance of Error.



94
95
96
97
98
# File 'lib/cloud_party/responses/ips.rb', line 94

def initialize(error)
  @error   = error
  @code    = error.fetch(:code, nil)
  @message = error.fetch(:message, nil)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



100
101
102
# File 'lib/cloud_party/responses/ips.rb', line 100

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



102
103
104
# File 'lib/cloud_party/responses/ips.rb', line 102

def message
  @message
end

Instance Method Details

#inspectObject



104
105
106
# File 'lib/cloud_party/responses/ips.rb', line 104

def inspect
  to_s
end

#to_sObject



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/cloud_party/responses/ips.rb', line 108

def to_s
  wanted_methods = %i[code message]
  our_methods    = methods.select do |m|
    wanted_methods.include? m
  end
  outputs = []
  our_methods.each do |m|
    outputs << "#{m}=#{send(m)}"
  end
  "#<Error: #{output.join(', ')}>"
end