Class: Gusto::ContractorPayments::ContractorPayment

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/contractor_payments/types/contractor_payment.rb

Overview

The representation of a single contractor payment.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, contractor_uuid: OMIT, bonus: OMIT, date: OMIT, hours: OMIT, payment_method: OMIT, reimbursement: OMIT, status: OMIT, hourly_rate: OMIT, may_cancel: OMIT, wage: OMIT, wage_type: OMIT, wage_total: OMIT, additional_properties: nil) ⇒ Gusto::ContractorPayments::ContractorPayment

Parameters:

  • uuid (String)

    The unique identifier of the contractor payment in Gusto.

  • contractor_uuid (String) (defaults to: OMIT)

    The UUID of the contractor.

  • bonus (String) (defaults to: OMIT)

    The bonus amount in the payment.

  • date (String) (defaults to: OMIT)

    The payment date.

  • hours (String) (defaults to: OMIT)

    The number of hours worked for the payment.

  • payment_method (Gusto::ContractorPayments::ContractorPaymentPaymentMethod) (defaults to: OMIT)

    The payment method.

  • reimbursement (String) (defaults to: OMIT)

    The reimbursement amount in the payment.

  • status (Gusto::ContractorPayments::ContractorPaymentStatus) (defaults to: OMIT)

    Contractor payment status

  • hourly_rate (String) (defaults to: OMIT)

    The rate per hour worked for the payment.

  • may_cancel (Boolean) (defaults to: OMIT)

    Determine if the contractor payment can be cancelled.

  • wage (String) (defaults to: OMIT)

    The fixed wage of the payment, regardless of hours worked.

  • wage_type (Gusto::ContractorPayments::ContractorPaymentWageType) (defaults to: OMIT)

    The wage type for the payment.

  • wage_total (String) (defaults to: OMIT)

    (hours * hourly_rate) + wage + bonus

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 61

def initialize(uuid:, contractor_uuid: OMIT, bonus: OMIT, date: OMIT, hours: OMIT, payment_method: OMIT, reimbursement: OMIT, status: OMIT, hourly_rate: OMIT, may_cancel: OMIT, wage: OMIT, wage_type: OMIT, wage_total: OMIT, additional_properties: nil)
  @uuid = uuid
  @contractor_uuid = contractor_uuid if contractor_uuid != OMIT
  @bonus = bonus if bonus != OMIT
  @date = date if date != OMIT
  @hours = hours if hours != OMIT
  @payment_method = payment_method if payment_method != OMIT
  @reimbursement = reimbursement if reimbursement != OMIT
  @status = status if status != OMIT
  @hourly_rate = hourly_rate if hourly_rate != OMIT
  @may_cancel = may_cancel if may_cancel != OMIT
  @wage = wage if wage != OMIT
  @wage_type = wage_type if wage_type != OMIT
  @wage_total = wage_total if wage_total != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "contractor_uuid": contractor_uuid, "bonus": bonus, "date": date, "hours": hours, "payment_method": payment_method, "reimbursement": reimbursement, "status": status, "hourly_rate": hourly_rate, "may_cancel": may_cancel, "wage": wage, "wage_type": wage_type, "wage_total": wage_total }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



39
40
41
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 39

def additional_properties
  @additional_properties
end

#bonusString (readonly)

Returns The bonus amount in the payment.

Returns:

  • (String)

    The bonus amount in the payment.



17
18
19
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 17

def bonus
  @bonus
end

#contractor_uuidString (readonly)

Returns The UUID of the contractor.

Returns:

  • (String)

    The UUID of the contractor.



15
16
17
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 15

def contractor_uuid
  @contractor_uuid
end

#dateString (readonly)

Returns The payment date.

Returns:

  • (String)

    The payment date.



19
20
21
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 19

def date
  @date
end

#hourly_rateString (readonly)

Returns The rate per hour worked for the payment.

Returns:

  • (String)

    The rate per hour worked for the payment.



29
30
31
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 29

def hourly_rate
  @hourly_rate
end

#hoursString (readonly)

Returns The number of hours worked for the payment.

Returns:

  • (String)

    The number of hours worked for the payment.



21
22
23
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 21

def hours
  @hours
end

#may_cancelBoolean (readonly)

Returns Determine if the contractor payment can be cancelled.

Returns:

  • (Boolean)

    Determine if the contractor payment can be cancelled.



31
32
33
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 31

def may_cancel
  @may_cancel
end

#payment_methodGusto::ContractorPayments::ContractorPaymentPaymentMethod (readonly)

Returns The payment method.



23
24
25
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 23

def payment_method
  @payment_method
end

#reimbursementString (readonly)

Returns The reimbursement amount in the payment.

Returns:

  • (String)

    The reimbursement amount in the payment.



25
26
27
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 25

def reimbursement
  @reimbursement
end

#statusGusto::ContractorPayments::ContractorPaymentStatus (readonly)

Returns Contractor payment status.

Returns:



27
28
29
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 27

def status
  @status
end

#uuidString (readonly)

Returns The unique identifier of the contractor payment in Gusto.

Returns:

  • (String)

    The unique identifier of the contractor payment in Gusto.



13
14
15
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 13

def uuid
  @uuid
end

#wageString (readonly)

Returns The fixed wage of the payment, regardless of hours worked.

Returns:

  • (String)

    The fixed wage of the payment, regardless of hours worked.



33
34
35
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 33

def wage
  @wage
end

#wage_totalString (readonly)

Returns (hours * hourly_rate) + wage + bonus.

Returns:

  • (String)

    (hours * hourly_rate) + wage + bonus



37
38
39
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 37

def wage_total
  @wage_total
end

#wage_typeGusto::ContractorPayments::ContractorPaymentWageType (readonly)

Returns The wage type for the payment.

Returns:



35
36
37
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 35

def wage_type
  @wage_type
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::ContractorPayments::ContractorPayment

Parameters:

  • json_object (String)

Returns:



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/fern_gusto/contractor_payments/types/contractor_payment.rb', line 84

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  contractor_uuid = parsed_json["contractor_uuid"]
  bonus = parsed_json["bonus"]
  date = parsed_json["date"]
  hours = parsed_json["hours"]
  payment_method = parsed_json["payment_method"]
  reimbursement = parsed_json["reimbursement"]
  status = parsed_json["status"]
  hourly_rate = parsed_json["hourly_rate"]
  may_cancel = parsed_json["may_cancel"]
  wage = parsed_json["wage"]
  wage_type = parsed_json["wage_type"]
  wage_total = parsed_json["wage_total"]
  new(
    uuid: uuid,
    contractor_uuid: contractor_uuid,
    bonus: bonus,
    date: date,
    hours: hours,
    payment_method: payment_method,
    reimbursement: reimbursement,
    status: status,
    hourly_rate: hourly_rate,
    may_cancel: may_cancel,
    wage: wage,
    wage_type: wage_type,
    wage_total: wage_total,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 129

def self.validate_raw(obj:)
  obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.")
  obj.contractor_uuid&.is_a?(String) != false || raise("Passed value for field obj.contractor_uuid is not the expected type, validation failed.")
  obj.bonus&.is_a?(String) != false || raise("Passed value for field obj.bonus is not the expected type, validation failed.")
  obj.date&.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
  obj.hours&.is_a?(String) != false || raise("Passed value for field obj.hours is not the expected type, validation failed.")
  obj.payment_method&.is_a?(Gusto::ContractorPayments::ContractorPaymentPaymentMethod) != false || raise("Passed value for field obj.payment_method is not the expected type, validation failed.")
  obj.reimbursement&.is_a?(String) != false || raise("Passed value for field obj.reimbursement is not the expected type, validation failed.")
  obj.status&.is_a?(Gusto::ContractorPayments::ContractorPaymentStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.hourly_rate&.is_a?(String) != false || raise("Passed value for field obj.hourly_rate is not the expected type, validation failed.")
  obj.may_cancel&.is_a?(Boolean) != false || raise("Passed value for field obj.may_cancel is not the expected type, validation failed.")
  obj.wage&.is_a?(String) != false || raise("Passed value for field obj.wage is not the expected type, validation failed.")
  obj.wage_type&.is_a?(Gusto::ContractorPayments::ContractorPaymentWageType) != false || raise("Passed value for field obj.wage_type is not the expected type, validation failed.")
  obj.wage_total&.is_a?(String) != false || raise("Passed value for field obj.wage_total is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


120
121
122
# File 'lib/fern_gusto/contractor_payments/types/contractor_payment.rb', line 120

def to_json
  @_field_set&.to_json
end