Exception: ShedCloud::PartnerApi::PartnerApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/shedcloud/partner_api/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status:, body: nil, code: nil) ⇒ PartnerApiError

Returns a new instance of PartnerApiError.



8
9
10
11
12
13
# File 'lib/shedcloud/partner_api/errors.rb', line 8

def initialize(message, status:, body: nil, code: nil)
  @status = status
  @body = body
  @code = code
  super(format_message(message))
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/shedcloud/partner_api/errors.rb', line 6

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/shedcloud/partner_api/errors.rb', line 6

def code
  @code
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/shedcloud/partner_api/errors.rb', line 6

def status
  @status
end

Instance Method Details

#forbidden?Boolean

Returns:

  • (Boolean)


16
# File 'lib/shedcloud/partner_api/errors.rb', line 16

def forbidden? = status == 403

#not_found?Boolean

Returns:

  • (Boolean)


17
# File 'lib/shedcloud/partner_api/errors.rb', line 17

def not_found? = status == 404

#rate_limited?Boolean

Returns:

  • (Boolean)


18
# File 'lib/shedcloud/partner_api/errors.rb', line 18

def rate_limited? = status == 429

#unauthorized?Boolean

Returns:

  • (Boolean)


15
# File 'lib/shedcloud/partner_api/errors.rb', line 15

def unauthorized? = status == 401