Class: Vapi::SchedulePlan
- Inherits:
-
Object
- Object
- Vapi::SchedulePlan
- Defined in:
- lib/vapi_server_sdk/types/schedule_plan.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#earliest_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of the earliest time the call can be scheduled.
-
#latest_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of the latest time the call can be scheduled.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::SchedulePlan
Deserialize a JSON object to an instance of SchedulePlan.
-
.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(earliest_at:, latest_at: OMIT, additional_properties: nil) ⇒ Vapi::SchedulePlan constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of SchedulePlan to a JSON object.
Constructor Details
#initialize(earliest_at:, latest_at: OMIT, additional_properties: nil) ⇒ Vapi::SchedulePlan
29 30 31 32 33 34 35 36 |
# File 'lib/vapi_server_sdk/types/schedule_plan.rb', line 29 def initialize(earliest_at:, latest_at: OMIT, additional_properties: nil) @earliest_at = earliest_at @latest_at = latest_at if latest_at != OMIT @additional_properties = additional_properties @_field_set = { "earliestAt": earliest_at, "latestAt": latest_at }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/vapi_server_sdk/types/schedule_plan.rb', line 16 def additional_properties @additional_properties end |
#earliest_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of the earliest time the call can be scheduled.
11 12 13 |
# File 'lib/vapi_server_sdk/types/schedule_plan.rb', line 11 def earliest_at @earliest_at end |
#latest_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of the latest time the call can be scheduled.
14 15 16 |
# File 'lib/vapi_server_sdk/types/schedule_plan.rb', line 14 def latest_at @latest_at end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::SchedulePlan
Deserialize a JSON object to an instance of SchedulePlan
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/vapi_server_sdk/types/schedule_plan.rb', line 42 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) earliest_at = (DateTime.parse(parsed_json["earliestAt"]) unless parsed_json["earliestAt"].nil?) latest_at = (DateTime.parse(parsed_json["latestAt"]) unless parsed_json["latestAt"].nil?) new( earliest_at: earliest_at, latest_at: latest_at, 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.
67 68 69 70 |
# File 'lib/vapi_server_sdk/types/schedule_plan.rb', line 67 def self.validate_raw(obj:) obj.earliest_at.is_a?(DateTime) != false || raise("Passed value for field obj.earliest_at is not the expected type, validation failed.") obj.latest_at&.is_a?(DateTime) != false || raise("Passed value for field obj.latest_at is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of SchedulePlan to a JSON object
57 58 59 |
# File 'lib/vapi_server_sdk/types/schedule_plan.rb', line 57 def to_json(*_args) @_field_set&.to_json end |