Class: FdxV660Api::PaystubEntity2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/paystub_entity2.rb

Overview

JSON response containing Base64-encoded PaystubPdf content if not encrypted, or as the JSON payload which is encrypted for an application/jwt response

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(paystub_id: SKIP, paystub_pdf: SKIP, embedded_data: SKIP, additional_properties: nil) ⇒ PaystubEntity2

Returns a new instance of PaystubEntity2.



56
57
58
59
60
61
62
63
64
65
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 56

def initialize(paystub_id: SKIP, paystub_pdf: SKIP, embedded_data: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @paystub_id = paystub_id unless paystub_id == SKIP
  @paystub_pdf = paystub_pdf unless paystub_pdf == SKIP
  @embedded_data = embedded_data unless embedded_data == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#embedded_dataTrueClass | FalseClass

Whether the paystub PDF also contains an embedded JSON payload of the Paystub data. That should include three custom properties: fdxVersion containing the version number of the FDX release, fdxSoftwareId if software creating the embedded data is registered with FDX, and fdxJson containing the JSON payload matching the Paystub entity defined here

Returns:

  • (TrueClass | FalseClass)


31
32
33
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 31

def embedded_data
  @embedded_data
end

#paystub_idString

The paystub identification number requested. This can be any ID which the data provider creates specific to the consenting person's paystub, perhaps simply the pay date as a string optionally followed by a sequence number: "2024-09-30-01". Need only be unique within the current employee's consent / token, according to data provider's preference

Returns:

  • (String)


19
20
21
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 19

def paystub_id
  @paystub_id
end

#paystub_pdfBinary

The Base64-encoded content of the paystub PDF file

Returns:

  • (Binary)


23
24
25
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 23

def paystub_pdf
  @paystub_pdf
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  paystub_id = hash.key?('paystubId') ? hash['paystubId'] : SKIP
  paystub_pdf = hash.key?('paystubPdf') ? hash['paystubPdf'] : SKIP
  embedded_data = hash.key?('embeddedData') ? hash['embeddedData'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  PaystubEntity2.new(paystub_id: paystub_id,
                     paystub_pdf: paystub_pdf,
                     embedded_data: embedded_data,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['paystub_id'] = 'paystubId'
  @_hash['paystub_pdf'] = 'paystubPdf'
  @_hash['embedded_data'] = 'embeddedData'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
48
49
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 43

def self.optionals
  %w[
    paystub_id
    paystub_pdf
    embedded_data
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



98
99
100
101
102
103
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 98

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} paystub_id: #{@paystub_id.inspect}, paystub_pdf: #{@paystub_pdf.inspect},"\
  " embedded_data: #{@embedded_data.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
# File 'lib/fdx_v660_api/models/paystub_entity2.rb', line 91

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} paystub_id: #{@paystub_id}, paystub_pdf: #{@paystub_pdf}, embedded_data:"\
  " #{@embedded_data}, additional_properties: #{@additional_properties}>"
end