Module: Avmtrf1::Tools::Msgraph::ResponseMixin

Defined in:
lib/avmtrf1/tools/msgraph/response_mixin.rb

Constant Summary collapse

ERROR_KEY =
'error'
INVALID_TOKEN_CODE =
'InvalidAuthenticationToken'
VALUE_KEY =
'value'

Instance Method Summary collapse

Instance Method Details

#body_data_or_raiseObject



14
15
16
17
18
19
20
# File 'lib/avmtrf1/tools/msgraph/response_mixin.rb', line 14

def body_data_or_raise
  check_invalid_token
  r = super
  return r unless r.is_a?(::Hash)

  body_hash_or_raise(r)
end

#error_codeString?

Returns:

  • (String, nil)


23
24
25
26
27
28
# File 'lib/avmtrf1/tools/msgraph/response_mixin.rb', line 23

def error_code
  return false unless body_data.is_a?(::Hash)
  return false unless body_data.key?(ERROR_KEY)

  body_data.fetch(ERROR_KEY).fetch('code')
end