Class: PaypalServerSdk::Patch
- Defined in:
- lib/paypal_server_sdk/models/patch.rb
Overview
The JSON patch object to apply partial updates to resources.
Instance Attribute Summary collapse
-
#from ⇒ String
The JSON Pointer to the target document location from which to move the value.
-
#op ⇒ PatchOp
The operation.
-
#path ⇒ String
The JSON Pointer to the target document location at which to complete the operation.
-
#value ⇒ Object
The value to apply.
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(op:, path: SKIP, value: SKIP, from: SKIP) ⇒ Patch
constructor
A new instance of Patch.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(op:, path: SKIP, value: SKIP, from: SKIP) ⇒ Patch
Returns a new instance of Patch.
56 57 58 59 60 61 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 56 def initialize(op:, path: SKIP, value: SKIP, from: SKIP) @op = op @path = path unless path == SKIP @value = value unless value == SKIP @from = from unless from == SKIP end |
Instance Attribute Details
#from ⇒ String
The JSON Pointer to the target document location from which to move the value. Required for the move operation.
30 31 32 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 30 def from @from end |
#op ⇒ PatchOp
The operation.
14 15 16 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 14 def op @op end |
#path ⇒ String
The JSON Pointer to the target document location at which to complete the operation.
19 20 21 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 19 def path @path end |
#value ⇒ Object
The value to apply. The remove, copy, and move operations do not require a value. Since JSON Patch allows any type for value, the type property is not specified.
25 26 27 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 25 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. op = hash.key?('op') ? hash['op'] : nil path = hash.key?('path') ? hash['path'] : SKIP value = hash.key?('value') ? hash['value'] : SKIP from = hash.key?('from') ? hash['from'] : SKIP # Create object from extracted values. Patch.new(op: op, path: path, value: value, from: from) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['op'] = 'op' @_hash['path'] = 'path' @_hash['value'] = 'value' @_hash['from'] = 'from' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 43 def self.optionals %w[ path value from ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
87 88 89 90 91 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 87 def inspect class_name = self.class.name.split('::').last "<#{class_name} op: #{@op.inspect}, path: #{@path.inspect}, value: #{@value.inspect}, from:"\ " #{@from.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
81 82 83 84 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 81 def to_s class_name = self.class.name.split('::').last "<#{class_name} op: #{@op}, path: #{@path}, value: #{@value}, from: #{@from}>" end |