Class: Courier::Models::ProviderPatchParams::Patch

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/courier/models/provider_patch_params.rb,
sig/courier/models/provider_patch_params.rbs

Defined Under Namespace

Modules: Op

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(op:, path:, from: nil, value: nil) ⇒ Patch

One JSON Patch (RFC 6902) operation.

Parameters:

  • op (Symbol, Courier::Models::ProviderPatchParams::Patch::Op) —

    The operation to perform.

  • path (String) —

    JSON Pointer to the field to operate on, such as /settings/api_key.

  • from (String) (defaults to: nil) —

    JSON Pointer to the source field for move and copy.

  • value (Object) (defaults to: nil) —

    The value for add, replace and test. Any JSON value.

  • op: (Courier::Models::ProviderPatchParams::Patch::op)
  • path: (String)
  • from: (String) (defaults to: nil)
  • value: (top) (defaults to: nil)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/courier/models/provider_patch_params.rb', line 36

class Patch < Courier::Internal::Type::BaseModel
  # @!attribute op
  #   The operation to perform.
  #
  #   @return [Symbol, Courier::Models::ProviderPatchParams::Patch::Op]
  required :op, enum: -> { Courier::ProviderPatchParams::Patch::Op }

  # @!attribute path
  #   JSON Pointer to the field to operate on, such as `/settings/api_key`.
  #
  #   @return [String]
  required :path, String

  # @!attribute from
  #   JSON Pointer to the source field for `move` and `copy`.
  #
  #   @return [String, nil]
  optional :from, String

  # @!attribute value
  #   The value for `add`, `replace` and `test`. Any JSON value.
  #
  #   @return [Object, nil]
  optional :value, Courier::Internal::Type::Unknown

  # @!method initialize(op:, path:, from: nil, value: nil)
  #   One JSON Patch (RFC 6902) operation.
  #
  #   @param op [Symbol, Courier::Models::ProviderPatchParams::Patch::Op] The operation to perform.
  #
  #   @param path [String] JSON Pointer to the field to operate on, such as `/settings/api_key`.
  #
  #   @param from [String] JSON Pointer to the source field for `move` and `copy`.
  #
  #   @param value [Object] The value for `add`, `replace` and `test`. Any JSON value.

  # The operation to perform.
  #
  # @see Courier::Models::ProviderPatchParams::Patch#op
  module Op
    extend Courier::Internal::Type::Enum

    ADD = :add
    REMOVE = :remove
    REPLACE = :replace
    MOVE = :move
    COPY = :copy
    TEST = :test

    # @!method self.values
    #   @return [Array<Symbol>]
  end
end

Instance Attribute Details

#from ⇒ String?

JSON Pointer to the source field for move and copy.

Parameters:

  • (String)

Returns:

  • (String, nil)


53
# File 'lib/courier/models/provider_patch_params.rb', line 53

optional :from, String

#op ⇒ Symbol, Courier::Models::ProviderPatchParams::Patch::Op

The operation to perform.

Parameters:

  • value (Courier::Models::ProviderPatchParams::Patch::op)

Returns:



41
# File 'lib/courier/models/provider_patch_params.rb', line 41

required :op, enum: -> { Courier::ProviderPatchParams::Patch::Op }

#path ⇒ String

JSON Pointer to the field to operate on, such as /settings/api_key.

Parameters:

  • value (String)

Returns:

  • (String)


47
# File 'lib/courier/models/provider_patch_params.rb', line 47

required :path, String

#value ⇒ Object?

The value for add, replace and test. Any JSON value.

Parameters:

  • (top)

Returns:

  • (Object, nil)


59
# File 'lib/courier/models/provider_patch_params.rb', line 59

optional :value, Courier::Internal::Type::Unknown

Instance Method Details

#to_hash ⇒ { op: Courier::Models::ProviderPatchParams::Patch::op, path: String, from: String, value: top }

Returns:

  • ({ op: Courier::Models::ProviderPatchParams::Patch::op, path: String, from: String, value: top })


55
56
57
58
59
60
# File 'sig/courier/models/provider_patch_params.rbs', line 55

def to_hash: -> {
  op: Courier::Models::ProviderPatchParams::Patch::op,
  path: String,
  from: String,
  value: top
}