Class: PaypalServerSdk::Patch

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

Overview

The JSON patch object to apply partial updates to resources.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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

#fromString

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.

Returns:

  • (String)


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

def from
  @from
end

#opPatchOp

The operation.

Returns:



14
15
16
# File 'lib/paypal_server_sdk/models/patch.rb', line 14

def op
  @op
end

#pathString

The <a href=“tools.ietf.org/html/rfc6901”>JSON Pointer</a> to the target document location at which to complete the operation.

Returns:

  • (String)


19
20
21
# File 'lib/paypal_server_sdk/models/patch.rb', line 19

def path
  @path
end

#valueObject

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.

Returns:

  • (Object)


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

.namesObject

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

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/paypal_server_sdk/models/patch.rb', line 55

def self.nullables
  []
end

.optionalsObject

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