Class: PaypalServerSdk::TransactionSearchErrorDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/transaction_search_error_details.rb

Overview

The error details. Required for client-side ‘4XX` errors.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(issue:, field: SKIP, value: SKIP, location: 'body', description: SKIP) ⇒ TransactionSearchErrorDetails

Returns a new instance of TransactionSearchErrorDetails.



61
62
63
64
65
66
67
68
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 61

def initialize(issue:, field: SKIP, value: SKIP, location: 'body',
               description: SKIP)
  @field = field unless field == SKIP
  @value = value unless value == SKIP
  @location = location unless location == SKIP
  @issue = issue
  @description = description unless description == SKIP
end

Instance Attribute Details

#descriptionString

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.

Returns:

  • (String)


33
34
35
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 33

def description
  @description
end

#fieldString

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.

Returns:

  • (String)


15
16
17
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 15

def field
  @field
end

#issueString

The unique, fine-grained application-level error code.

Returns:

  • (String)


28
29
30
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 28

def issue
  @issue
end

#locationString

The location of the field that caused the error. Value is ‘body`, `path`, or `query`.

Returns:

  • (String)


24
25
26
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 24

def location
  @location
end

#valueString

The value of the field that caused the error.

Returns:

  • (String)


19
20
21
# File 'lib/paypal_server_sdk/models/transaction_search_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.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 71

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'
  description = hash.key?('description') ? hash['description'] : SKIP

  # Create object from extracted values.

  TransactionSearchErrorDetails.new(issue: issue,
                                    field: field,
                                    value: value,
                                    location: location,
                                    description: description)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
44
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['field'] = 'field'
  @_hash['value'] = 'value'
  @_hash['location'] = 'location'
  @_hash['issue'] = 'issue'
  @_hash['description'] = 'description'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
53
54
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 47

def self.optionals
  %w[
    field
    value
    location
    description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



97
98
99
100
101
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 97

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} field: #{@field.inspect}, value: #{@value.inspect}, location:"\
  " #{@location.inspect}, issue: #{@issue.inspect}, description: #{@description.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



90
91
92
93
94
# File 'lib/paypal_server_sdk/models/transaction_search_error_details.rb', line 90

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} field: #{@field}, value: #{@value}, location: #{@location}, issue:"\
  " #{@issue}, description: #{@description}>"
end