Class: Raas::RaasClientErrorModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/raas/models/raas_client_error_model.rb

Overview

Represents a RaaS 4xx Error

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(path = nil, message = nil, constraint = nil, invalid_value = nil) ⇒ RaasClientErrorModel

Returns a new instance of RaasClientErrorModel.



33
34
35
36
37
38
39
40
41
# File 'lib/raas/models/raas_client_error_model.rb', line 33

def initialize(path = nil,
               message = nil,
               constraint = nil,
               invalid_value = nil)
  @path = path
  @message = message
  @constraint = constraint
  @invalid_value = invalid_value
end

Instance Attribute Details

#constraintString

The constraint validated

Returns:



17
18
19
# File 'lib/raas/models/raas_client_error_model.rb', line 17

def constraint
  @constraint
end

#invalid_valueString

The value that was invalid

Returns:



21
22
23
# File 'lib/raas/models/raas_client_error_model.rb', line 21

def invalid_value
  @invalid_value
end

#messageString

The error message

Returns:



13
14
15
# File 'lib/raas/models/raas_client_error_model.rb', line 13

def message
  @message
end

#pathString

The path to the invalid value

Returns:



9
10
11
# File 'lib/raas/models/raas_client_error_model.rb', line 9

def path
  @path
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/raas/models/raas_client_error_model.rb', line 44

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  path = hash['path']
  message = hash['message']
  constraint = hash['constraint']
  invalid_value = hash['invalidValue']

  # Create object from extracted values.
  RaasClientErrorModel.new(path,
                           message,
                           constraint,
                           invalid_value)
end

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
30
31
# File 'lib/raas/models/raas_client_error_model.rb', line 24

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['path'] = 'path'
  @_hash['message'] = 'message'
  @_hash['constraint'] = 'constraint'
  @_hash['invalid_value'] = 'invalidValue'
  @_hash
end