Class: Plaid::NetPay
- Defined in:
- lib/plaid/models/net_pay.rb
Overview
An object representing information about the net pay amount on the paystub.
Instance Attribute Summary collapse
-
#distribution_details ⇒ Array[DistributionDetails]
TODO: Write general description for this method.
-
#total ⇒ Total
An object representing both the current pay period and year to date amount for a category.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(distribution_details: SKIP, total: SKIP, additional_properties: nil) ⇒ NetPay
constructor
A new instance of NetPay.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(distribution_details: SKIP, total: SKIP, additional_properties: nil) ⇒ NetPay
Returns a new instance of NetPay.
42 43 44 45 46 47 48 49 50 |
# File 'lib/plaid/models/net_pay.rb', line 42 def initialize(distribution_details: SKIP, total: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @distribution_details = distribution_details unless distribution_details == SKIP @total = total unless total == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#distribution_details ⇒ Array[DistributionDetails]
TODO: Write general description for this method
14 15 16 |
# File 'lib/plaid/models/net_pay.rb', line 14 def distribution_details @distribution_details end |
#total ⇒ Total
An object representing both the current pay period and year to date amount for a category.
19 20 21 |
# File 'lib/plaid/models/net_pay.rb', line 19 def total @total 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/plaid/models/net_pay.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it distribution_details = nil unless hash['distribution_details'].nil? distribution_details = [] hash['distribution_details'].each do |structure| distribution_details << (DistributionDetails.from_hash(structure) if structure) end end distribution_details = SKIP unless hash.key?('distribution_details') total = Total.from_hash(hash['total']) if hash['total'] # 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. NetPay.new(distribution_details: distribution_details, total: total, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 |
# File 'lib/plaid/models/net_pay.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['distribution_details'] = 'distribution_details' @_hash['total'] = 'total' @_hash end |
.nullables ⇒ Object
An array for nullable fields
38 39 40 |
# File 'lib/plaid/models/net_pay.rb', line 38 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
30 31 32 33 34 35 |
# File 'lib/plaid/models/net_pay.rb', line 30 def self.optionals %w[ distribution_details total ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
90 91 92 93 94 |
# File 'lib/plaid/models/net_pay.rb', line 90 def inspect class_name = self.class.name.split('::').last "<#{class_name} distribution_details: #{@distribution_details.inspect}, total:"\ " #{@total.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
83 84 85 86 87 |
# File 'lib/plaid/models/net_pay.rb', line 83 def to_s class_name = self.class.name.split('::').last "<#{class_name} distribution_details: #{@distribution_details}, total: #{@total},"\ " additional_properties: #{@additional_properties}>" end |