Class: UspsApi::LabelsJsonPatchRequest1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/labels_json_patch_request1.rb

Overview

LabelsJsonPatchRequest1 Model.

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(path:, value: SKIP) ⇒ LabelsJsonPatchRequest1

Returns a new instance of LabelsJsonPatchRequest1.



46
47
48
49
50
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 46

def initialize(path:, value: SKIP)
  @op = 'replace'
  @path = path
  @value = value unless value == SKIP
end

Instance Attribute Details

#opString (readonly)

The operation to perform on the resource.

Returns:

  • (String)


14
15
16
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 14

def op
  @op
end

#pathPath

The object or array location to perform the update to the resource. Must be a JSON pointer value.

Returns:



19
20
21
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 19

def path
  @path
end

#valueObject

Can be anything: string, number, array, object, etc. (except ‘null`)

Returns:

  • (Object)


23
24
25
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 23

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 53

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  path = hash.key?('path') ? hash['path'] : nil
  value = hash.key?('value') ? hash['value'] : SKIP

  # Create object from extracted values.
  LabelsJsonPatchRequest1.new(path: path,
                              value: value)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['op'] = 'op'
  @_hash['path'] = 'path'
  @_hash['value'] = 'value'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 35

def self.optionals
  %w[
    value
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



72
73
74
75
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 72

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} op: #{@op.inspect}, path: #{@path.inspect}, value: #{@value.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



66
67
68
69
# File 'lib/usps_api/models/labels_json_patch_request1.rb', line 66

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} op: #{@op}, path: #{@path}, value: #{@value}>"
end