Class: CandidApiClient::ServiceLines::V2::Types::ServiceLineAdjustment

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(created_at:, adjustment_group_code: OMIT, adjustment_reason_code: OMIT, adjustment_amount_cents: OMIT, adjustment_note: OMIT, additional_properties: nil) ⇒ CandidApiClient::ServiceLines::V2::Types::ServiceLineAdjustment

Parameters:

  • created_at (DateTime)
  • adjustment_group_code (String) (defaults to: OMIT)
  • adjustment_reason_code (String) (defaults to: OMIT)
  • adjustment_amount_cents (Integer) (defaults to: OMIT)
  • adjustment_note (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 37

def initialize(created_at:, adjustment_group_code: OMIT, adjustment_reason_code: OMIT,
               adjustment_amount_cents: OMIT, adjustment_note: OMIT, additional_properties: nil)
  @created_at = created_at
  @adjustment_group_code = adjustment_group_code if adjustment_group_code != OMIT
  @adjustment_reason_code = adjustment_reason_code if adjustment_reason_code != OMIT
  @adjustment_amount_cents = adjustment_amount_cents if adjustment_amount_cents != OMIT
  @adjustment_note = adjustment_note if adjustment_note != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "created_at": created_at,
    "adjustment_group_code": adjustment_group_code,
    "adjustment_reason_code": adjustment_reason_code,
    "adjustment_amount_cents": adjustment_amount_cents,
    "adjustment_note": adjustment_note
  }.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



23
24
25
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 23

def additional_properties
  @additional_properties
end

#adjustment_amount_centsInteger (readonly)

Returns:

  • (Integer)


19
20
21
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 19

def adjustment_amount_cents
  @adjustment_amount_cents
end

#adjustment_group_codeString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 15

def adjustment_group_code
  @adjustment_group_code
end

#adjustment_noteString (readonly)

Returns:

  • (String)


21
22
23
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 21

def adjustment_note
  @adjustment_note
end

#adjustment_reason_codeString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 17

def adjustment_reason_code
  @adjustment_reason_code
end

#created_atDateTime (readonly)

Returns:

  • (DateTime)


13
14
15
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 13

def created_at
  @created_at
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::ServiceLines::V2::Types::ServiceLineAdjustment

Deserialize a JSON object to an instance of ServiceLineAdjustment

Parameters:

  • json_object (String)

Returns:



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 60

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?)
  adjustment_group_code = struct["adjustment_group_code"]
  adjustment_reason_code = struct["adjustment_reason_code"]
  adjustment_amount_cents = struct["adjustment_amount_cents"]
  adjustment_note = struct["adjustment_note"]
  new(
    created_at: created_at,
    adjustment_group_code: adjustment_group_code,
    adjustment_reason_code: adjustment_reason_code,
    adjustment_amount_cents: adjustment_amount_cents,
    adjustment_note: adjustment_note,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


91
92
93
94
95
96
97
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 91

def self.validate_raw(obj:)
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.adjustment_group_code&.is_a?(String) != false || raise("Passed value for field obj.adjustment_group_code is not the expected type, validation failed.")
  obj.adjustment_reason_code&.is_a?(String) != false || raise("Passed value for field obj.adjustment_reason_code is not the expected type, validation failed.")
  obj.adjustment_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.adjustment_amount_cents is not the expected type, validation failed.")
  obj.adjustment_note&.is_a?(String) != false || raise("Passed value for field obj.adjustment_note is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ServiceLineAdjustment to a JSON object

Returns:

  • (String)


81
82
83
# File 'lib/candidhealth/service_lines/v_2/types/service_line_adjustment.rb', line 81

def to_json(*_args)
  @_field_set&.to_json
end