Class: FdxV660Api::AnnualPaymentAmounts

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

Overview

Year to date amounts for current and previous years

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(year:, gross_pay:, net_pay: SKIP, additional_properties: nil) ⇒ AnnualPaymentAmounts

Returns a new instance of AnnualPaymentAmounts.



45
46
47
48
49
50
51
52
53
# File 'lib/fdx_v660_api/models/annual_payment_amounts.rb', line 45

def initialize(year:, gross_pay:, net_pay: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @year = year
  @gross_pay = gross_pay
  @net_pay = net_pay unless net_pay == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#gross_payPaymentAmounts2

Gross pay for covered period

Returns:



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

def gross_pay
  @gross_pay
end

#net_payMonetaryAmount5

Net pay for covered period

Returns:



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

def net_pay
  @net_pay
end

#yearInteger

The year in which this income was earned

Returns:

  • (Integer)


14
15
16
# File 'lib/fdx_v660_api/models/annual_payment_amounts.rb', line 14

def year
  @year
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/fdx_v660_api/models/annual_payment_amounts.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  year = hash.key?('year') ? hash['year'] : nil
  gross_pay = PaymentAmounts2.from_hash(hash['grossPay']) if hash['grossPay']
  net_pay = MonetaryAmount5.from_hash(hash['netPay']) if hash['netPay']

  # 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.
  AnnualPaymentAmounts.new(year: year,
                           gross_pay: gross_pay,
                           net_pay: net_pay,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/fdx_v660_api/models/annual_payment_amounts.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['year'] = 'year'
  @_hash['gross_pay'] = 'grossPay'
  @_hash['net_pay'] = 'netPay'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/fdx_v660_api/models/annual_payment_amounts.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    net_pay
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



86
87
88
89
90
# File 'lib/fdx_v660_api/models/annual_payment_amounts.rb', line 86

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

#to_sObject

Provides a human-readable string representation of the object.



79
80
81
82
83
# File 'lib/fdx_v660_api/models/annual_payment_amounts.rb', line 79

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