Class: PaypalServerSdk::SearchErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- PaypalServerSdk::SearchErrorException
- Defined in:
- lib/paypal_server_sdk/exceptions/search_error_exception.rb
Overview
The error details.
Instance Attribute Summary collapse
-
#debug_id ⇒ String
The PayPal internal ID.
-
#details ⇒ Array[TransactionSearchErrorDetails]
An array of additional details about the error.
-
#information_link ⇒ String
The information link, or URI, that shows detailed information about this error for the developer.
-
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).
-
#maximum_items ⇒ Integer
The maximum number of transactions.
-
#message ⇒ String
The message that describes the error.
-
#name ⇒ String
The human-readable, unique name of the error.
-
#total_items ⇒ Integer
The total number of transactions.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ SearchErrorException
constructor
The constructor.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ SearchErrorException
The constructor.
49 50 51 52 53 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 49 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#debug_id ⇒ String
The PayPal internal ID. Used for correlation purposes.
22 23 24 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 22 def debug_id @debug_id end |
#details ⇒ Array[TransactionSearchErrorDetails]
An array of additional details about the error.
31 32 33 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 31 def details @details end |
#information_link ⇒ String
The information link, or URI, that shows detailed information about this error for the developer.
27 28 29 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 27 def information_link @information_link end |
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).
36 37 38 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 36 def links @links end |
#maximum_items ⇒ Integer
The maximum number of transactions. Valid only for ‘RESULTSET_TOO_LARGE`.
44 45 46 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 44 def maximum_items @maximum_items end |
#message ⇒ String
The message that describes the error.
18 19 20 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 18 def @message end |
#name ⇒ String
The human-readable, unique name of the error.
14 15 16 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 14 def name @name end |
#total_items ⇒ Integer
The total number of transactions. Valid only for ‘RESULTSET_TOO_LARGE`.
40 41 42 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 40 def total_items @total_items end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 104 105 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, message: #{@message.inspect}, debug_id:"\ " #{@debug_id.inspect}, information_link: #{@information_link.inspect}, details:"\ " #{@details.inspect}, links: #{@links.inspect}, total_items: #{@total_items.inspect},"\ " maximum_items: #{@maximum_items.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
91 92 93 94 95 96 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 91 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, message: #{@message}, debug_id: #{@debug_id},"\ " information_link: #{@information_link}, details: #{@details}, links: #{@links},"\ " total_items: #{@total_items}, maximum_items: #{@maximum_items}>" end |
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/paypal_server_sdk/exceptions/search_error_exception.rb', line 58 def unbox(hash) return nil unless hash @name = hash.key?('name') ? hash['name'] : nil @message = hash.key?('message') ? hash['message'] : nil @debug_id = hash.key?('debug_id') ? hash['debug_id'] : nil @information_link = hash.key?('information_link') ? hash['information_link'] : SKIP # Parameter is an array, so we need to iterate through it @details = nil unless hash['details'].nil? @details = [] hash['details'].each do |structure| @details << (TransactionSearchErrorDetails.from_hash(structure) if structure) end end @details = SKIP unless hash.key?('details') # Parameter is an array, so we need to iterate through it @links = nil unless hash['links'].nil? @links = [] hash['links'].each do |structure| @links << (LinkDescription.from_hash(structure) if structure) end end @links = SKIP unless hash.key?('links') @total_items = hash.key?('total_items') ? hash['total_items'] : SKIP @maximum_items = hash.key?('maximum_items') ? hash['maximum_items'] : SKIP end |