Class: Gusto::Forms::Form
- Inherits:
-
Object
- Object
- Gusto::Forms::Form
- Defined in:
- lib/fern_gusto/forms/types/form.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#description ⇒ String
readonly
The description of the form.
-
#draft ⇒ Object
readonly
draft state prior to being finalized.
-
#name ⇒ String
readonly
The type identifier of the form.
-
#quarter ⇒ Object
readonly
value of 2022).
-
#requires_signing ⇒ Object
readonly
this value will change after the form is signed.
-
#title ⇒ String
readonly
The title of the form.
-
#uuid ⇒ String
readonly
The UUID of the form.
-
#year ⇒ Object
readonly
be present on all forms.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(uuid:, name: OMIT, title: OMIT, description: OMIT, draft: OMIT, year: OMIT, quarter: OMIT, requires_signing: OMIT, additional_properties: nil) ⇒ Gusto::Forms::Form constructor
- #to_json ⇒ String
Constructor Details
#initialize(uuid:, name: OMIT, title: OMIT, description: OMIT, draft: OMIT, year: OMIT, quarter: OMIT, requires_signing: OMIT, additional_properties: nil) ⇒ Gusto::Forms::Form
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fern_gusto/forms/types/form.rb', line 58 def initialize(uuid:, name: OMIT, title: OMIT, description: OMIT, draft: OMIT, year: OMIT, quarter: OMIT, requires_signing: OMIT, additional_properties: nil) @uuid = uuid @name = name if name != OMIT @title = title if title != OMIT @description = description if description != OMIT @draft = draft if draft != OMIT @year = year if year != OMIT @quarter = quarter if quarter != OMIT @requires_signing = requires_signing if requires_signing != OMIT @additional_properties = additional_properties @_field_set = { "uuid": uuid, "name": name, "title": title, "description": description, "draft": draft, "year": year, "quarter": quarter, "requires_signing": requires_signing }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
33 34 35 |
# File 'lib/fern_gusto/forms/types/form.rb', line 33 def additional_properties @additional_properties end |
#description ⇒ String (readonly)
Returns The description of the form.
15 16 17 |
# File 'lib/fern_gusto/forms/types/form.rb', line 15 def description @description end |
#draft ⇒ Object (readonly)
draft state prior to being finalized.
18 19 20 |
# File 'lib/fern_gusto/forms/types/form.rb', line 18 def draft @draft end |
#name ⇒ String (readonly)
Returns The type identifier of the form.
11 12 13 |
# File 'lib/fern_gusto/forms/types/form.rb', line 11 def name @name end |
#quarter ⇒ Object (readonly)
value of 2022). This value is nullable and will not be present on all forms.
28 29 30 |
# File 'lib/fern_gusto/forms/types/form.rb', line 28 def quarter @quarter end |
#requires_signing ⇒ Object (readonly)
this value will change after the form is signed.
31 32 33 |
# File 'lib/fern_gusto/forms/types/form.rb', line 31 def requires_signing @requires_signing end |
#title ⇒ String (readonly)
Returns The title of the form.
13 14 15 |
# File 'lib/fern_gusto/forms/types/form.rb', line 13 def title @title end |
#uuid ⇒ String (readonly)
Returns The UUID of the form.
9 10 11 |
# File 'lib/fern_gusto/forms/types/form.rb', line 9 def uuid @uuid end |
#year ⇒ Object (readonly)
be present on all forms.
23 24 25 |
# File 'lib/fern_gusto/forms/types/form.rb', line 23 def year @year end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Forms::Form
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/fern_gusto/forms/types/form.rb', line 76 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) uuid = parsed_json["uuid"] name = parsed_json["name"] title = parsed_json["title"] description = parsed_json["description"] draft = parsed_json["draft"] year = parsed_json["year"] quarter = parsed_json["quarter"] requires_signing = parsed_json["requires_signing"] new( uuid: uuid, name: name, title: title, description: description, draft: draft, year: year, quarter: quarter, requires_signing: requires_signing, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/fern_gusto/forms/types/form.rb', line 111 def self.validate_raw(obj:) obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.draft&.is_a?(Boolean) != false || raise("Passed value for field obj.draft is not the expected type, validation failed.") obj.year&.is_a?(Integer) != false || raise("Passed value for field obj.year is not the expected type, validation failed.") obj.quarter&.is_a?(Integer) != false || raise("Passed value for field obj.quarter is not the expected type, validation failed.") obj.requires_signing&.is_a?(Boolean) != false || raise("Passed value for field obj.requires_signing is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
102 103 104 |
# File 'lib/fern_gusto/forms/types/form.rb', line 102 def to_json @_field_set&.to_json end |