Class: Vapi::StructuredDataMultiPlan
- Inherits:
-
Object
- Object
- Vapi::StructuredDataMultiPlan
- Defined in:
- lib/vapi_server_sdk/types/structured_data_multi_plan.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#key ⇒ String
readonly
This is the key of the structured data plan in the catalog.
-
#plan ⇒ Vapi::StructuredDataPlan
readonly
This is an individual structured data plan in the catalog.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::StructuredDataMultiPlan
Deserialize a JSON object to an instance of StructuredDataMultiPlan.
-
.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.
Instance Method Summary collapse
- #initialize(key:, plan:, additional_properties: nil) ⇒ Vapi::StructuredDataMultiPlan constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of StructuredDataMultiPlan to a JSON object.
Constructor Details
#initialize(key:, plan:, additional_properties: nil) ⇒ Vapi::StructuredDataMultiPlan
25 26 27 28 29 30 |
# File 'lib/vapi_server_sdk/types/structured_data_multi_plan.rb', line 25 def initialize(key:, plan:, additional_properties: nil) @key = key @plan = plan @additional_properties = additional_properties @_field_set = { "key": key, "plan": plan } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
14 15 16 |
# File 'lib/vapi_server_sdk/types/structured_data_multi_plan.rb', line 14 def additional_properties @additional_properties end |
#key ⇒ String (readonly)
Returns This is the key of the structured data plan in the catalog.
10 11 12 |
# File 'lib/vapi_server_sdk/types/structured_data_multi_plan.rb', line 10 def key @key end |
#plan ⇒ Vapi::StructuredDataPlan (readonly)
Returns This is an individual structured data plan in the catalog.
12 13 14 |
# File 'lib/vapi_server_sdk/types/structured_data_multi_plan.rb', line 12 def plan @plan end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::StructuredDataMultiPlan
Deserialize a JSON object to an instance of StructuredDataMultiPlan
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vapi_server_sdk/types/structured_data_multi_plan.rb', line 36 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) key = parsed_json["key"] if parsed_json["plan"].nil? plan = nil else plan = parsed_json["plan"].to_json plan = Vapi::StructuredDataPlan.from_json(json_object: plan) end new( key: key, plan: plan, 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.
66 67 68 69 |
# File 'lib/vapi_server_sdk/types/structured_data_multi_plan.rb', line 66 def self.validate_raw(obj:) obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.") Vapi::StructuredDataPlan.validate_raw(obj: obj.plan) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of StructuredDataMultiPlan to a JSON object
56 57 58 |
# File 'lib/vapi_server_sdk/types/structured_data_multi_plan.rb', line 56 def to_json(*_args) @_field_set&.to_json end |