Class: Samsara::Types::FieldObjectValueResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::FieldObjectValueResponseBody
- Defined in:
- lib/samsara_api/types/field_object_value_response_body.rb
Overview
The value of the document field. The shape of value depends on the type.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#barcode_value ⇒ Array<Samsara::Types::BarcodeValueObjectResponseBody>
readonly
The value of a barcode scanning field.
- #date_time_value ⇒ Samsara::Types::DateTimeValueObjectResponseBody readonly
-
#multiple_choice_value ⇒ Array<Samsara::Types::MultipleChoiceValueObjectResponseBody>
readonly
The value of a multiple choice field.
-
#number_value ⇒ Float
readonly
The value of a number field.
-
#photo_value ⇒ Array<Samsara::Types::PhotoValueObjectResponseBody>
readonly
The value of a photo field.
-
#scanned_document_value ⇒ Array<Samsara::Types::ScannedDocumentValueObjectResponseBody>
readonly
The value of a scanned document field.
- #signature_value ⇒ Samsara::Types::SignatureValueObjectResponseBody readonly
-
#string_value ⇒ String
readonly
The value of a string field.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(barcode_value: OMIT, date_time_value: OMIT, multiple_choice_value: OMIT, number_value: OMIT, photo_value: OMIT, scanned_document_value: OMIT, signature_value: OMIT, string_value: OMIT, additional_properties: nil) ⇒ Samsara::Types::FieldObjectValueResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(barcode_value: OMIT, date_time_value: OMIT, multiple_choice_value: OMIT, number_value: OMIT, photo_value: OMIT, scanned_document_value: OMIT, signature_value: OMIT, string_value: OMIT, additional_properties: nil) ⇒ Samsara::Types::FieldObjectValueResponseBody
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 49 def initialize(barcode_value: OMIT, date_time_value: OMIT, multiple_choice_value: OMIT, number_value: OMIT, photo_value: OMIT, scanned_document_value: OMIT, signature_value: OMIT, string_value: OMIT, additional_properties: nil) @barcode_value = if != OMIT @date_time_value = date_time_value if date_time_value != OMIT @multiple_choice_value = multiple_choice_value if multiple_choice_value != OMIT @number_value = number_value if number_value != OMIT @photo_value = photo_value if photo_value != OMIT @scanned_document_value = scanned_document_value if scanned_document_value != OMIT @signature_value = signature_value if signature_value != OMIT @string_value = string_value if string_value != OMIT @additional_properties = additional_properties @_field_set = { "barcodeValue": , "dateTimeValue": date_time_value, "multipleChoiceValue": multiple_choice_value, "numberValue": number_value, "photoValue": photo_value, "scannedDocumentValue": scanned_document_value, "signatureValue": signature_value, "stringValue": string_value }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
32 33 34 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 32 def additional_properties @additional_properties end |
#barcode_value ⇒ Array<Samsara::Types::BarcodeValueObjectResponseBody> (readonly)
Returns The value of a barcode scanning field. Only present for barcode scanning fields.
16 17 18 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 16 def @barcode_value end |
#date_time_value ⇒ Samsara::Types::DateTimeValueObjectResponseBody (readonly)
18 19 20 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 18 def date_time_value @date_time_value end |
#multiple_choice_value ⇒ Array<Samsara::Types::MultipleChoiceValueObjectResponseBody> (readonly)
Returns The value of a multiple choice field. Only present for multiple choice fields.
20 21 22 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 20 def multiple_choice_value @multiple_choice_value end |
#number_value ⇒ Float (readonly)
Returns The value of a number field. Only present for number fields.
22 23 24 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 22 def number_value @number_value end |
#photo_value ⇒ Array<Samsara::Types::PhotoValueObjectResponseBody> (readonly)
Returns The value of a photo field. Only present for photo fields.
24 25 26 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 24 def photo_value @photo_value end |
#scanned_document_value ⇒ Array<Samsara::Types::ScannedDocumentValueObjectResponseBody> (readonly)
Returns The value of a scanned document field. Only present for scanned document fields.
26 27 28 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 26 def scanned_document_value @scanned_document_value end |
#signature_value ⇒ Samsara::Types::SignatureValueObjectResponseBody (readonly)
28 29 30 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 28 def signature_value @signature_value end |
#string_value ⇒ String (readonly)
Returns The value of a string field. Only present for string fields.
30 31 32 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 30 def string_value @string_value end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::FieldObjectValueResponseBody
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 67 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["barcodeValue"]&.map do | item | item = item.to_json Samsara::Types::BarcodeValueObjectResponseBody.from_json(json_object: item) end unless parsed_json["dateTimeValue"].nil? date_time_value = parsed_json["dateTimeValue"].to_json date_time_value = Samsara::Types::DateTimeValueObjectResponseBody.from_json(json_object: date_time_value) else date_time_value = nil end multiple_choice_value = parsed_json["multipleChoiceValue"]&.map do | item | item = item.to_json Samsara::Types::MultipleChoiceValueObjectResponseBody.from_json(json_object: item) end number_value = parsed_json["numberValue"] photo_value = parsed_json["photoValue"]&.map do | item | item = item.to_json Samsara::Types::PhotoValueObjectResponseBody.from_json(json_object: item) end scanned_document_value = parsed_json["scannedDocumentValue"]&.map do | item | item = item.to_json Samsara::Types::ScannedDocumentValueObjectResponseBody.from_json(json_object: item) end unless parsed_json["signatureValue"].nil? signature_value = parsed_json["signatureValue"].to_json signature_value = Samsara::Types::SignatureValueObjectResponseBody.from_json(json_object: signature_value) else signature_value = nil end string_value = parsed_json["stringValue"] new( barcode_value: , date_time_value: date_time_value, multiple_choice_value: multiple_choice_value, number_value: number_value, photo_value: photo_value, scanned_document_value: scanned_document_value, signature_value: signature_value, string_value: string_value, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
124 125 126 127 128 129 130 131 132 133 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 124 def self.validate_raw(obj:) obj.&.is_a?(Array) != false || raise("Passed value for field obj.barcode_value is not the expected type, validation failed.") obj.date_time_value.nil? || Samsara::Types::DateTimeValueObjectResponseBody.validate_raw(obj: obj.date_time_value) obj.multiple_choice_value&.is_a?(Array) != false || raise("Passed value for field obj.multiple_choice_value is not the expected type, validation failed.") obj.number_value&.is_a?(Float) != false || raise("Passed value for field obj.number_value is not the expected type, validation failed.") obj.photo_value&.is_a?(Array) != false || raise("Passed value for field obj.photo_value is not the expected type, validation failed.") obj.scanned_document_value&.is_a?(Array) != false || raise("Passed value for field obj.scanned_document_value is not the expected type, validation failed.") obj.signature_value.nil? || Samsara::Types::SignatureValueObjectResponseBody.validate_raw(obj: obj.signature_value) obj.string_value&.is_a?(String) != false || raise("Passed value for field obj.string_value is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
115 116 117 |
# File 'lib/samsara_api/types/field_object_value_response_body.rb', line 115 def to_json @_field_set&.to_json end |