Class: CandidApiClient::OrganizationProviders::V2::Types::OrganizationProviderAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address:, address_type:, additional_properties: nil) ⇒ CandidApiClient::OrganizationProviders::V2::Types::OrganizationProviderAddress

Parameters:



29
30
31
32
33
34
# File 'lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb', line 29

def initialize(address:, address_type:, additional_properties: nil)
  @address = address
  @address_type = address_type
  @additional_properties = additional_properties
  @_field_set = { "address": address, "address_type": address_type }
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



18
19
20
# File 'lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb', line 18

def additional_properties
  @additional_properties
end

#addressCandidApiClient::Commons::Types::StreetAddressLongZip (readonly)

Returns The address of the provider.

Returns:



14
15
16
# File 'lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb', line 14

def address
  @address
end

#address_typeCandidApiClient::OrganizationProviders::V2::Types::AddressType (readonly)

Returns The address type of the provider.

Returns:



16
17
18
# File 'lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb', line 16

def address_type
  @address_type
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::OrganizationProviders::V2::Types::OrganizationProviderAddress

Deserialize a JSON object to an instance of OrganizationProviderAddress



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb', line 40

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["address"].nil?
    address = nil
  else
    address = parsed_json["address"].to_json
    address = CandidApiClient::Commons::Types::StreetAddressLongZip.from_json(json_object: address)
  end
  address_type = struct["address_type"]
  new(
    address: address,
    address_type: address_type,
    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)


70
71
72
73
# File 'lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb', line 70

def self.validate_raw(obj:)
  CandidApiClient::Commons::Types::StreetAddressLongZip.validate_raw(obj: obj.address)
  obj.address_type.is_a?(CandidApiClient::OrganizationProviders::V2::Types::AddressType) != false || raise("Passed value for field obj.address_type is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of OrganizationProviderAddress to a JSON object

Returns:

  • (String)


60
61
62
# File 'lib/candidhealth/organization_providers/v_2/types/organization_provider_address.rb', line 60

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