Exception: TinyAppstoreConnect::ConnectAPIError
- Defined in:
- lib/tiny_appstore_connect.rb
Direct Known Subclasses
ForbiddenError, InvalidEntityError, InvalidUserCredentialsError, NotFoundError, RateLimitExceededError
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, status_code, errors) ⇒ ConnectAPIError
constructor
A new instance of ConnectAPIError.
Constructor Details
#initialize(message, status_code, errors) ⇒ ConnectAPIError
Returns a new instance of ConnectAPIError.
56 57 58 59 |
# File 'lib/tiny_appstore_connect.rb', line 56 def initialize(, status_code, errors) @status_code, @errors = status_code, errors super() end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
13 14 15 |
# File 'lib/tiny_appstore_connect.rb', line 13 def errors @errors end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
13 14 15 |
# File 'lib/tiny_appstore_connect.rb', line 13 def status_code @status_code end |
Class Method Details
.from_errors(response) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tiny_appstore_connect.rb', line 20 def from_errors(response) status_code = response.status # 403 will returns content-type with value '*/*' FUCK! body = response.body.is_a?(String) ? JSON.load(response.body) : response.body errors = body['errors'] = ["Check errors(#{errors.size}) from response:"] errors.each_with_index do |error, i| = [] << "#{i + 1}." << "[#{error['status']}:#{error['code']}]" << "#{error['title']}:" << error['detail'] << "in #{error['source']}" unless error['source'].to_s.empty? << .join(' ') end new(.join(' '), status_code, errors) end |
.parse(response) ⇒ Object
16 17 18 |
# File 'lib/tiny_appstore_connect.rb', line 16 def parse(response) handel_error(response) end |