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 <a href=“tools.ietf.org/html/rfc6901”>JSON Pointer</a> to the target document location from which to move the value.
-
#op ⇒ PatchOp
The operation.
-
#path ⇒ String
The <a href=“tools.ietf.org/html/rfc6901”>JSON Pointer</a> 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.
Methods inherited from BaseModel
Constructor Details
#initialize(op:, path: SKIP, value: SKIP, from: SKIP) ⇒ Patch
Returns a new instance of Patch.
59 60 61 62 63 64 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 59 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 <a href=“tools.ietf.org/html/rfc6901”>JSON Pointer</a> to the target document location from which to move the value. Required for the move
operation.
33 34 35 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 33 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 <a href=“tools.ietf.org/html/rfc6901”>JSON Pointer</a> 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 <a href=“www.rfc-editor.org/rfc/rfc69021”>JSON Patch</a> allows any type for value
, the type
property is not specified.
27 28 29 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 27 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 67 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.
36 37 38 39 40 41 42 43 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 36 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
55 56 57 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 |
# File 'lib/paypal_server_sdk/models/patch.rb', line 46 def self.optionals %w[ path value from ] end |