Class: PaypalServerSdk::ErrorDetails
- Defined in:
- lib/paypal_server_sdk/models/error_details.rb
Overview
The error details. Required for client-side ‘4XX` errors.
Instance Attribute Summary collapse
-
#description ⇒ String
The human-readable description for an issue.
-
#field ⇒ String
The field that caused the error.
-
#issue ⇒ String
The unique, fine-grained application-level error code.
-
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/api/rest/responses/#hateoas-links) that are either relevant to the issue by providing additional information or offering potential resolutions.
-
#location ⇒ String
The location of the field that caused the error.
-
#value ⇒ String
The value of the field that caused the error.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(issue:, field: SKIP, value: SKIP, location: 'body', links: SKIP, description: SKIP) ⇒ ErrorDetails
constructor
A new instance of ErrorDetails.
Methods inherited from BaseModel
Constructor Details
#initialize(issue:, field: SKIP, value: SKIP, location: 'body', links: SKIP, description: SKIP) ⇒ ErrorDetails
Returns a new instance of ErrorDetails.
70 71 72 73 74 75 76 77 78 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 70 def initialize(issue:, field: SKIP, value: SKIP, location: 'body', links: SKIP, description: SKIP) @field = field unless field == SKIP @value = value unless value == SKIP @location = location unless location == SKIP @issue = issue @links = links unless links == SKIP @description = description unless description == SKIP end |
Instance Attribute Details
#description ⇒ String
The human-readable description for an issue. The description can change over the lifetime of an API, so clients must not depend on this value.
40 41 42 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 40 def description @description end |
#field ⇒ String
The field that caused the error. If this field is in the body, set this value to the field’s JSON pointer value. Required for client-side errors.
15 16 17 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 15 def field @field end |
#issue ⇒ String
The unique, fine-grained application-level error code.
28 29 30 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 28 def issue @issue end |
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/api/rest/responses/#hateoas-links) that are either relevant to the issue by providing additional information or offering potential resolutions.
35 36 37 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 35 def links @links end |
#location ⇒ String
The location of the field that caused the error. Value is ‘body`, `path`, or `query`.
24 25 26 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 24 def location @location end |
#value ⇒ String
The value of the field that caused the error.
19 20 21 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 19 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. issue = hash.key?('issue') ? hash['issue'] : nil field = hash.key?('field') ? hash['field'] : SKIP value = hash.key?('value') ? hash['value'] : SKIP location = hash['location'] ||= 'body' # 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') description = hash.key?('description') ? hash['description'] : SKIP # Create object from extracted values. ErrorDetails.new(issue: issue, field: field, value: value, location: location, links: links, description: description) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['field'] = 'field' @_hash['value'] = 'value' @_hash['location'] = 'location' @_hash['issue'] = 'issue' @_hash['links'] = 'links' @_hash['description'] = 'description' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 62 63 |
# File 'lib/paypal_server_sdk/models/error_details.rb', line 55 def self.optionals %w[ field value location links description ] end |