Class: FdxV660Api::PaymentAmounts2

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

Overview

Gross pay for covered period

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(total:, base: SKIP, bonus: SKIP, commission: SKIP, overtime: SKIP, other_earnings: SKIP, additional_properties: nil) ⇒ PaymentAmounts2

Returns a new instance of PaymentAmounts2.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 65

def initialize(total:, base: SKIP, bonus: SKIP, commission: SKIP,
               overtime: SKIP, other_earnings: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @total = total
  @base = base unless base == SKIP
  @bonus = bonus unless bonus == SKIP
  @commission = commission unless commission == SKIP
  @overtime = overtime unless overtime == SKIP
  @other_earnings = other_earnings unless other_earnings == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#baseMonetaryAmount1

Base pay part of Gross pay for covered period

Returns:



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

def base
  @base
end

#bonusMonetaryAmount2

Bonus pay for covered period

Returns:



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

def bonus
  @bonus
end

#commissionMonetaryAmount3

Commission for covered period

Returns:



26
27
28
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 26

def commission
  @commission
end

#other_earningsArray[PayAmount]

Other earnings received in covered period. With name, amount, and currency (and can optionally contain year-to-date amount)

Returns:



35
36
37
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 35

def other_earnings
  @other_earnings
end

#overtimeMonetaryAmount4

Overtime pay for covered period

Returns:



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

def overtime
  @overtime
end

#totalMonetaryAmount9

Total gross pay for covered period

Returns:



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

def total
  @total
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total = MonetaryAmount9.from_hash(hash['total']) if hash['total']
  base = MonetaryAmount1.from_hash(hash['base']) if hash['base']
  bonus = MonetaryAmount2.from_hash(hash['bonus']) if hash['bonus']
  commission = MonetaryAmount3.from_hash(hash['commission']) if hash['commission']
  overtime = MonetaryAmount4.from_hash(hash['overtime']) if hash['overtime']
  # Parameter is an array, so we need to iterate through it
  other_earnings = nil
  unless hash['otherEarnings'].nil?
    other_earnings = []
    hash['otherEarnings'].each do |structure|
      other_earnings << (PayAmount.from_hash(structure) if structure)
    end
  end

  other_earnings = SKIP unless hash.key?('otherEarnings')

  # 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.
  PaymentAmounts2.new(total: total,
                      base: base,
                      bonus: bonus,
                      commission: commission,
                      overtime: overtime,
                      other_earnings: other_earnings,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total'] = 'total'
  @_hash['base'] = 'base'
  @_hash['bonus'] = 'bonus'
  @_hash['commission'] = 'commission'
  @_hash['overtime'] = 'overtime'
  @_hash['other_earnings'] = 'otherEarnings'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 50

def self.optionals
  %w[
    base
    bonus
    commission
    overtime
    other_earnings
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 127

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} total: #{@total.inspect}, base: #{@base.inspect}, bonus: #{@bonus.inspect},"\
  " commission: #{@commission.inspect}, overtime: #{@overtime.inspect}, other_earnings:"\
  " #{@other_earnings.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
# File 'lib/fdx_v660_api/models/payment_amounts2.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} total: #{@total}, base: #{@base}, bonus: #{@bonus}, commission:"\
  " #{@commission}, overtime: #{@overtime}, other_earnings: #{@other_earnings},"\
  " additional_properties: #{@additional_properties}>"
end