Class: FdxV660Api::PaystubEntity1

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

Overview

PDF file of a single paystub

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) ⇒ PaystubEntity1

Returns a new instance of PaystubEntity1.



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

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)


30
31
32
# File 'lib/fdx_v660_api/models/paystub_entity1.rb', line 30

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)


18
19
20
# File 'lib/fdx_v660_api/models/paystub_entity1.rb', line 18

def paystub_id
  @paystub_id
end

#paystub_pdfBinary

The Base64-encoded content of the paystub PDF file

Returns:

  • (Binary)


22
23
24
# File 'lib/fdx_v660_api/models/paystub_entity1.rb', line 22

def paystub_pdf
  @paystub_pdf
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
82
83
84
85
86
87
# File 'lib/fdx_v660_api/models/paystub_entity1.rb', line 67

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.
  PaystubEntity1.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.



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

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



51
52
53
# File 'lib/fdx_v660_api/models/paystub_entity1.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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.



90
91
92
93
94
# File 'lib/fdx_v660_api/models/paystub_entity1.rb', line 90

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