Class: Senko::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, instance_location:, keyword_location:, keyword:, schema: nil, data: nil) ⇒ Error

Returns a new instance of Error.



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

def initialize(message:, instance_location:, keyword_location:, keyword:, schema: nil, data: nil)
  @message = message
  @instance_location = instance_location
  @keyword_location = keyword_location
  @keyword = keyword
  @schema = schema
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/senko/errors.rb', line 5

def data
  @data
end

#instance_locationObject (readonly) Also known as: path

Returns the value of attribute instance_location.



5
6
7
# File 'lib/senko/errors.rb', line 5

def instance_location
  @instance_location
end

#keywordObject (readonly)

Returns the value of attribute keyword.



5
6
7
# File 'lib/senko/errors.rb', line 5

def keyword
  @keyword
end

#keyword_locationObject (readonly) Also known as: schema_path

Returns the value of attribute keyword_location.



5
6
7
# File 'lib/senko/errors.rb', line 5

def keyword_location
  @keyword_location
end

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/senko/errors.rb', line 5

def message
  @message
end

#schemaObject (readonly)

Returns the value of attribute schema.



5
6
7
# File 'lib/senko/errors.rb', line 5

def schema
  @schema
end

Instance Method Details

#to_hObject



19
20
21
22
23
24
25
# File 'lib/senko/errors.rb', line 19

def to_h
  {
    'keywordLocation' => keyword_location,
    'instanceLocation' => instance_location,
    'error' => message
  }
end