Exception: AppStoreConnectApi::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- AppStoreConnectApi::ApiError
- Defined in:
- lib/app_store_connect_api/api_error.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #associated_errors ⇒ Object
- #code ⇒ Object
- #details ⇒ Object
-
#initialize(errors) ⇒ ApiError
constructor
A new instance of ApiError.
- #status ⇒ Object
Constructor Details
#initialize(errors) ⇒ ApiError
Returns a new instance of ApiError.
7 8 9 10 |
# File 'lib/app_store_connect_api/api_error.rb', line 7 def initialize(errors) @errors = errors super 'App Store Connect API request failed' end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/app_store_connect_api/api_error.rb', line 5 def errors @errors end |
Instance Method Details
#associated_errors ⇒ Object
24 25 26 27 28 29 |
# File 'lib/app_store_connect_api/api_error.rb', line 24 def associated_errors associated_errors = errors.map { |error| error.dig :meta, :associated_errors }.compact return [] if associated_errors.blank? associated_errors.map { |error_hash| error_hash.map { |_, errors| errors.pluck :detail } }.flatten end |
#code ⇒ Object
12 13 14 |
# File 'lib/app_store_connect_api/api_error.rb', line 12 def code errors.first[:code] end |
#details ⇒ Object
20 21 22 |
# File 'lib/app_store_connect_api/api_error.rb', line 20 def details errors.map { |e| [e[:title], e[:detail]] }.flatten.uniq end |
#status ⇒ Object
16 17 18 |
# File 'lib/app_store_connect_api/api_error.rb', line 16 def status errors.first[:status].to_i end |