Class: CandidApiClient::Commons::Types::StreetAddressLongZip

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/commons/types/street_address_long_zip.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zip_plus_four_code:, address_1:, city:, state:, zip_code:, address_2: OMIT, additional_properties: nil) ⇒ CandidApiClient::Commons::Types::StreetAddressLongZip

Parameters:

  • zip_plus_four_code (String)

    4-digit zip add-on code en.wikipedia.org/wiki/ZIP_Code#ZIP+4

  • address_1 (String)
  • address_2 (String) (defaults to: OMIT)
  • city (String)
  • state (CandidApiClient::Commons::Types::State)
  • zip_code (String)

    5-digit zip code

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 39

def initialize(zip_plus_four_code:, address_1:, city:, state:, zip_code:, address_2: OMIT,
               additional_properties: nil)
  @zip_plus_four_code = zip_plus_four_code
  @address_1 = address_1
  @address_2 = address_2 if address_2 != OMIT
  @city = city
  @state = state
  @zip_code = zip_code
  @additional_properties = additional_properties
  @_field_set = {
    "zip_plus_four_code": zip_plus_four_code,
    "address1": address_1,
    "address2": address_2,
    "city": city,
    "state": state,
    "zip_code": zip_code
  }.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



24
25
26
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 24

def additional_properties
  @additional_properties
end

#address_1String (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 14

def address_1
  @address_1
end

#address_2String (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 16

def address_2
  @address_2
end

#cityString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 18

def city
  @city
end

#stateCandidApiClient::Commons::Types::State (readonly)



20
21
22
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 20

def state
  @state
end

#zip_codeString (readonly)

Returns 5-digit zip code.

Returns:

  • (String)

    5-digit zip code



22
23
24
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 22

def zip_code
  @zip_code
end

#zip_plus_four_codeString (readonly)

Returns 4-digit zip add-on code en.wikipedia.org/wiki/ZIP_Code#ZIP+4.

Returns:



12
13
14
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 12

def zip_plus_four_code
  @zip_plus_four_code
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Commons::Types::StreetAddressLongZip

Deserialize a JSON object to an instance of StreetAddressLongZip

Parameters:

  • json_object (String)

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 64

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  zip_plus_four_code = struct["zip_plus_four_code"]
  address_1 = struct["address1"]
  address_2 = struct["address2"]
  city = struct["city"]
  state = struct["state"]
  zip_code = struct["zip_code"]
  new(
    zip_plus_four_code: zip_plus_four_code,
    address_1: address_1,
    address_2: address_2,
    city: city,
    state: state,
    zip_code: zip_code,
    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)


96
97
98
99
100
101
102
103
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 96

def self.validate_raw(obj:)
  obj.zip_plus_four_code.is_a?(String) != false || raise("Passed value for field obj.zip_plus_four_code is not the expected type, validation failed.")
  obj.address_1.is_a?(String) != false || raise("Passed value for field obj.address_1 is not the expected type, validation failed.")
  obj.address_2&.is_a?(String) != false || raise("Passed value for field obj.address_2 is not the expected type, validation failed.")
  obj.city.is_a?(String) != false || raise("Passed value for field obj.city is not the expected type, validation failed.")
  obj.state.is_a?(CandidApiClient::Commons::Types::State) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
  obj.zip_code.is_a?(String) != false || raise("Passed value for field obj.zip_code is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of StreetAddressLongZip to a JSON object

Returns:

  • (String)


86
87
88
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 86

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