Class: Fulfillment::ServiceError

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

Overview

Service errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_body = {}) ⇒ ServiceError

Returns a new instance of ServiceError.



12
13
14
# File 'lib/fulfillment/errors.rb', line 12

def initialize(response_body = {})
  @error = response_body.fetch("error", {}) if response_body
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



10
11
12
# File 'lib/fulfillment/errors.rb', line 10

def error
  @error
end

Instance Method Details

#messageObject Also known as: to_s



16
17
18
# File 'lib/fulfillment/errors.rb', line 16

def message
  error&.dig("message")
end

#statusObject



21
22
23
# File 'lib/fulfillment/errors.rb', line 21

def status
  error&.dig("status")
end

#typeObject



25
26
27
# File 'lib/fulfillment/errors.rb', line 25

def type
  error&.dig("type")
end