Class: CandidApiClient::PreEncounter::Appointments::V1::Types::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(universal_service_identifier: OMIT, start_timestamp: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::Service

Parameters:



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb', line 30

def initialize(universal_service_identifier: OMIT, start_timestamp: OMIT, additional_properties: nil)
  @universal_service_identifier = universal_service_identifier if universal_service_identifier != OMIT
  @start_timestamp = start_timestamp if start_timestamp != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "universal_service_identifier": universal_service_identifier,
    "start_timestamp": start_timestamp
  }.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



19
20
21
# File 'lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb', line 19

def additional_properties
  @additional_properties
end

#start_timestampDateTime (readonly)

Returns:

  • (DateTime)


17
18
19
# File 'lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb', line 17

def start_timestamp
  @start_timestamp
end

#universal_service_identifierCandidApiClient::PreEncounter::Appointments::V1::Types::UniversalServiceIdentifier (readonly)

Returns Contains the code describing the activity type that is being scheduled.

Returns:



15
16
17
# File 'lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb', line 15

def universal_service_identifier
  @universal_service_identifier
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Appointments::V1::Types::Service

Deserialize a JSON object to an instance of Service

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  universal_service_identifier = struct["universal_service_identifier"]
  start_timestamp = unless parsed_json["start_timestamp"].nil?
                      DateTime.parse(parsed_json["start_timestamp"])
                    end
  new(
    universal_service_identifier: universal_service_identifier,
    start_timestamp: start_timestamp,
    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)


73
74
75
76
# File 'lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb', line 73

def self.validate_raw(obj:)
  obj.universal_service_identifier&.is_a?(CandidApiClient::PreEncounter::Appointments::V1::Types::UniversalServiceIdentifier) != false || raise("Passed value for field obj.universal_service_identifier is not the expected type, validation failed.")
  obj.start_timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.start_timestamp is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Service to a JSON object

Returns:

  • (String)


63
64
65
# File 'lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb', line 63

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