Class: Gusto::Documents::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/documents/types/document.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid: OMIT, title: OMIT, name: OMIT, recipient_type: OMIT, recipient_uuid: OMIT, pages: OMIT, fields: OMIT, signed_at: OMIT, description: OMIT, requires_signing: OMIT, draft: OMIT, year: OMIT, quarter: OMIT, additional_properties: nil) ⇒ Gusto::Documents::Document

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/fern_gusto/documents/types/document.rb', line 76

def initialize(uuid: OMIT, title: OMIT, name: OMIT, recipient_type: OMIT, recipient_uuid: OMIT, pages: OMIT, fields: OMIT, signed_at: OMIT, description: OMIT, requires_signing: OMIT, draft: OMIT, year: OMIT, quarter: OMIT, additional_properties: nil)
  @uuid = uuid if uuid != OMIT
  @title = title if title != OMIT
  @name = name if name != OMIT
  @recipient_type = recipient_type if recipient_type != OMIT
  @recipient_uuid = recipient_uuid if recipient_uuid != OMIT
  @pages = pages if pages != OMIT
  @fields = fields if fields != OMIT
  @signed_at = signed_at if signed_at != OMIT
  @description = description if description != OMIT
  @requires_signing = requires_signing if requires_signing != OMIT
  @draft = draft if draft != OMIT
  @year = year if year != OMIT
  @quarter = quarter if quarter != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "title": title, "name": name, "recipient_type": recipient_type, "recipient_uuid": recipient_uuid, "pages": pages, "fields": fields, "signed_at": signed_at, "description": description, "requires_signing": requires_signing, "draft": draft, "year": year, "quarter": quarter }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



46
47
48
# File 'lib/fern_gusto/documents/types/document.rb', line 46

def additional_properties
  @additional_properties
end

#descriptionString (readonly)

Returns The description of the document.

Returns:

  • (String)

    The description of the document



33
34
35
# File 'lib/fern_gusto/documents/types/document.rb', line 33

def description
  @description
end

#draftBoolean (readonly)

Returns If the document is in a draft state.

Returns:

  • (Boolean)

    If the document is in a draft state



38
39
40
# File 'lib/fern_gusto/documents/types/document.rb', line 38

def draft
  @draft
end

#fieldsObject (readonly)

‘true`, and can be used for signing preparation.



29
30
31
# File 'lib/fern_gusto/documents/types/document.rb', line 29

def fields
  @fields
end

#nameString (readonly)

Returns The type identifier of the document.

Returns:

  • (String)

    The type identifier of the document



16
17
18
# File 'lib/fern_gusto/documents/types/document.rb', line 16

def name
  @name
end

#pagesObject (readonly)

preparation.



25
26
27
# File 'lib/fern_gusto/documents/types/document.rb', line 25

def pages
  @pages
end

#quarterObject (readonly)

all documents.



44
45
46
# File 'lib/fern_gusto/documents/types/document.rb', line 44

def quarter
  @quarter
end

#recipient_typeObject (readonly)

Contractor Documents)



19
20
21
# File 'lib/fern_gusto/documents/types/document.rb', line 19

def recipient_type
  @recipient_type
end

#recipient_uuidString (readonly)

Returns Unique identifier for the recipient associated with the document.

Returns:

  • (String)

    Unique identifier for the recipient associated with the document



21
22
23
# File 'lib/fern_gusto/documents/types/document.rb', line 21

def recipient_uuid
  @recipient_uuid
end

#requires_signingObject (readonly)

that this value will change after the document is signed.



36
37
38
# File 'lib/fern_gusto/documents/types/document.rb', line 36

def requires_signing
  @requires_signing
end

#signed_atString (readonly)

Returns When the document was signed (will be ‘null` if unsigned).

Returns:

  • (String)

    When the document was signed (will be ‘null` if unsigned)



31
32
33
# File 'lib/fern_gusto/documents/types/document.rb', line 31

def signed_at
  @signed_at
end

#titleString (readonly)

Returns The title of the document.

Returns:

  • (String)

    The title of the document



14
15
16
# File 'lib/fern_gusto/documents/types/document.rb', line 14

def title
  @title
end

#uuidString (readonly)

Returns The UUID of the document.

Returns:

  • (String)

    The UUID of the document



12
13
14
# File 'lib/fern_gusto/documents/types/document.rb', line 12

def uuid
  @uuid
end

#yearObject (readonly)

documents.



41
42
43
# File 'lib/fern_gusto/documents/types/document.rb', line 41

def year
  @year
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Documents::Document

Parameters:

  • json_object (String)

Returns:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/fern_gusto/documents/types/document.rb', line 99

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  title = parsed_json["title"]
  name = parsed_json["name"]
  recipient_type = parsed_json["recipient_type"]
  recipient_uuid = parsed_json["recipient_uuid"]
  pages = parsed_json["pages"]&.map do | item |
  item = item.to_json
  Gusto::Documents::DocumentPagesItem.from_json(json_object: item)
end
  fields = parsed_json["fields"]&.map do | item |
  item = item.to_json
  Gusto::Documents::DocumentFieldsItem.from_json(json_object: item)
end
  signed_at = parsed_json["signed_at"]
  description = parsed_json["description"]
  requires_signing = parsed_json["requires_signing"]
  draft = parsed_json["draft"]
  year = parsed_json["year"]
  quarter = parsed_json["quarter"]
  new(
    uuid: uuid,
    title: title,
    name: name,
    recipient_type: recipient_type,
    recipient_uuid: recipient_uuid,
    pages: pages,
    fields: fields,
    signed_at: signed_at,
    description: description,
    requires_signing: requires_signing,
    draft: draft,
    year: year,
    quarter: quarter,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/fern_gusto/documents/types/document.rb', line 150

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.title&.is_a?(String) != false || raise("Passed value for field obj.title 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.recipient_type&.is_a?(Gusto::Documents::DocumentRecipientType) != false || raise("Passed value for field obj.recipient_type is not the expected type, validation failed.")
  obj.recipient_uuid&.is_a?(String) != false || raise("Passed value for field obj.recipient_uuid is not the expected type, validation failed.")
  obj.pages&.is_a?(Array) != false || raise("Passed value for field obj.pages is not the expected type, validation failed.")
  obj.fields&.is_a?(Array) != false || raise("Passed value for field obj.fields is not the expected type, validation failed.")
  obj.signed_at&.is_a?(String) != false || raise("Passed value for field obj.signed_at 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.requires_signing&.is_a?(Boolean) != false || raise("Passed value for field obj.requires_signing 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.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


141
142
143
# File 'lib/fern_gusto/documents/types/document.rb', line 141

def to_json
  @_field_set&.to_json
end