Exception: MarketplaceKit::Errors::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/marketplace_kit/errors/api_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed_response) ⇒ ApiError

Returns a new instance of ApiError.



6
7
8
9
# File 'lib/marketplace_kit/errors/api_error.rb', line 6

def initialize(parsed_response)
  @parsed_response = parsed_response
  super('Invalid API response!')
end

Instance Attribute Details

#parsed_responseObject (readonly)

Returns the value of attribute parsed_response.



4
5
6
# File 'lib/marketplace_kit/errors/api_error.rb', line 4

def parsed_response
  @parsed_response
end

Instance Method Details

#detailsObject



19
20
21
# File 'lib/marketplace_kit/errors/api_error.rb', line 19

def details
  @parsed_response['details']
end

#messageObject



11
12
13
# File 'lib/marketplace_kit/errors/api_error.rb', line 11

def message
  @parsed_response['error'] || meta_message
end

#meta_messageObject



15
16
17
# File 'lib/marketplace_kit/errors/api_error.rb', line 15

def meta_message
  @parsed_response['meta']['message'] if @parsed_response['meta']
end