Class: SmashRuby::Errors::NotFoundError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, request) ⇒ NotFoundError

Returns a new instance of NotFoundError.



8
9
10
11
# File 'lib/smash_ruby/errors/not_found_error.rb', line 8

def initialize(model, request)
  @model = model
  @request = request
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



6
7
8
# File 'lib/smash_ruby/errors/not_found_error.rb', line 6

def model
  @model
end

#requestObject (readonly)

Returns the value of attribute request.



6
7
8
# File 'lib/smash_ruby/errors/not_found_error.rb', line 6

def request
  @request
end

Instance Method Details

#to_jsonObject



13
14
15
16
17
18
19
# File 'lib/smash_ruby/errors/not_found_error.rb', line 13

def to_json
  {
    model: @model,
    status: 404,
    error: "Not found with request: #{@request}"
  }.to_json
end