Class: Gusto::Documents::DocumentFieldsItem
- Inherits:
-
Object
- Object
- Gusto::Documents::DocumentFieldsItem
- Defined in:
- lib/fern_gusto/documents/types/document_fields_item.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#data_type ⇒ String
readonly
The field’s data type.
-
#height ⇒ Integer
readonly
Height of the field.
-
#key ⇒ String
readonly
Unique identifier of the field.
-
#page_number ⇒ Integer
readonly
Page number of the field.
-
#required ⇒ Boolean
readonly
Whether the field is required.
-
#value ⇒ String
readonly
Auto-filled value of the field.
-
#width ⇒ Integer
readonly
Width of the field.
-
#x ⇒ Integer
readonly
X-coordinate location of the field on the page.
-
#y ⇒ Integer
readonly
Y-coordinate location of the field on the page.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(key: OMIT, value: OMIT, x: OMIT, y: OMIT, width: OMIT, height: OMIT, page_number: OMIT, data_type: OMIT, required: OMIT, additional_properties: nil) ⇒ Gusto::Documents::DocumentFieldsItem constructor
- #to_json ⇒ String
Constructor Details
#initialize(key: OMIT, value: OMIT, x: OMIT, y: OMIT, width: OMIT, height: OMIT, page_number: OMIT, data_type: OMIT, required: OMIT, additional_properties: nil) ⇒ Gusto::Documents::DocumentFieldsItem
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 45 def initialize(key: OMIT, value: OMIT, x: OMIT, y: OMIT, width: OMIT, height: OMIT, page_number: OMIT, data_type: OMIT, required: OMIT, additional_properties: nil) @key = key if key != OMIT @value = value if value != OMIT @x = x if x != OMIT @y = y if y != OMIT @width = width if width != OMIT @height = height if height != OMIT @page_number = page_number if page_number != OMIT @data_type = data_type if data_type != OMIT @required = required if required != OMIT @additional_properties = additional_properties @_field_set = { "key": key, "value": value, "x": x, "y": y, "width": width, "height": height, "page_number": page_number, "data_type": data_type, "required": required }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
27 28 29 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 27 def additional_properties @additional_properties end |
#data_type ⇒ String (readonly)
Returns The field’s data type.
23 24 25 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 23 def data_type @data_type end |
#height ⇒ Integer (readonly)
Returns Height of the field.
19 20 21 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 19 def height @height end |
#key ⇒ String (readonly)
Returns Unique identifier of the field.
9 10 11 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 9 def key @key end |
#page_number ⇒ Integer (readonly)
Returns Page number of the field.
21 22 23 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 21 def page_number @page_number end |
#required ⇒ Boolean (readonly)
Returns Whether the field is required.
25 26 27 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 25 def required @required end |
#value ⇒ String (readonly)
Returns Auto-filled value of the field.
11 12 13 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 11 def value @value end |
#width ⇒ Integer (readonly)
Returns Width of the field.
17 18 19 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 17 def width @width end |
#x ⇒ Integer (readonly)
Returns X-coordinate location of the field on the page.
13 14 15 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 13 def x @x end |
#y ⇒ Integer (readonly)
Returns Y-coordinate location of the field on the page.
15 16 17 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 15 def y @y end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Documents::DocumentFieldsItem
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 64 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) key = parsed_json["key"] value = parsed_json["value"] x = parsed_json["x"] y = parsed_json["y"] width = parsed_json["width"] height = parsed_json["height"] page_number = parsed_json["page_number"] data_type = parsed_json["data_type"] required = parsed_json["required"] new( key: key, value: value, x: x, y: y, width: width, height: height, page_number: page_number, data_type: data_type, required: required, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 101 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.") obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") obj.x&.is_a?(Integer) != false || raise("Passed value for field obj.x is not the expected type, validation failed.") obj.y&.is_a?(Integer) != false || raise("Passed value for field obj.y is not the expected type, validation failed.") obj.width&.is_a?(Integer) != false || raise("Passed value for field obj.width is not the expected type, validation failed.") obj.height&.is_a?(Integer) != false || raise("Passed value for field obj.height is not the expected type, validation failed.") obj.page_number&.is_a?(Integer) != false || raise("Passed value for field obj.page_number is not the expected type, validation failed.") obj.data_type&.is_a?(String) != false || raise("Passed value for field obj.data_type is not the expected type, validation failed.") obj.required&.is_a?(Boolean) != false || raise("Passed value for field obj.required is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
92 93 94 |
# File 'lib/fern_gusto/documents/types/document_fields_item.rb', line 92 def to_json @_field_set&.to_json end |