Class: Samsara::Types::IssueResponseObjectResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/issue_response_object_response_body.rb

Overview

Issue response object.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(asset: OMIT, assigned_to: OMIT, created_at_time:, description: OMIT, due_date: OMIT, external_ids: OMIT, id:, issue_source:, media_list: OMIT, priority: OMIT, status:, submitted_at_time:, submitted_by:, title:, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::IssueResponseObjectResponseBody

Parameters:

  • submitted_at_time (DateTime) —

    Submission time of the issue. UTC timestamp in RFC 3339 format.

  • submitted_by (Samsara::Types::FormsPolymorphicUserObjectResponseBody)
  • title (String) —

    Title of the issue.

  • updated_at_time (DateTime) —

    Update time of the issue. UTC timestamp in RFC 3339 format.

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 80

def initialize(asset: OMIT, assigned_to: OMIT, created_at_time:, description: OMIT, due_date: OMIT, external_ids: OMIT, id:, issue_source:, media_list: OMIT, priority: OMIT, status:, submitted_at_time:, submitted_by:, title:, updated_at_time:, additional_properties: nil)
  @asset = asset if asset != OMIT
  @assigned_to = assigned_to if assigned_to != OMIT
  @created_at_time = created_at_time
  @description = description if description != OMIT
  @due_date = due_date if due_date != OMIT
  @external_ids = external_ids if external_ids != OMIT
  @id = id
  @issue_source = issue_source
  @media_list = media_list if media_list != OMIT
  @priority = priority if priority != OMIT
  @status = status
  @submitted_at_time = 
  @submitted_by = 
  @title = title
  @updated_at_time = updated_at_time
  @additional_properties = additional_properties
  @_field_set = { "asset": asset, "assignedTo": assigned_to, "createdAtTime": created_at_time, "description": description, "dueDate": due_date, "externalIds": external_ids, "id": id, "issueSource": issue_source, "mediaList": media_list, "priority": priority, "status": status, "submittedAtTime": , "submittedBy": , "title": title, "updatedAtTime": updated_at_time }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



53
54
55
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 53

def additional_properties
  @additional_properties
end

#asset ⇒ Samsara::Types::FormsAssetObjectResponseBody (readonly)



20
21
22
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 20

def asset
  @asset
end

#assigned_to ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBody (readonly)



22
23
24
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 22

def assigned_to
  @assigned_to
end

#created_at_time ⇒ DateTime (readonly)

Returns Creation time of the issue. UTC timestamp in RFC 3339 format.

Returns:

  • (DateTime) —

    Creation time of the issue. UTC timestamp in RFC 3339 format.



24
25
26
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 24

def created_at_time
  @created_at_time
end

#description ⇒ String (readonly)

Returns Description of the issue. Included if the issue was given a description.

Returns:

  • (String) —

    Description of the issue. Included if the issue was given a description.



26
27
28
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 26

def description
  @description
end

#due_date ⇒ Object (readonly)

was assigned a due date.



29
30
31
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 29

def due_date
  @due_date
end

#external_ids ⇒ Hash{String => String} (readonly)

Returns A map of external ids.

Returns:

  • (Hash{String => String}) —

    A map of external ids



31
32
33
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 31

def external_ids
  @external_ids
end

#id ⇒ String (readonly)

Returns ID of the issue.

Returns:

  • (String) —

    ID of the issue.



33
34
35
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 33

def id
  @id
end

#issue_source ⇒ Samsara::Types::IssueSourceObjectResponseBody (readonly)



35
36
37
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 35

def issue_source
  @issue_source
end

#media_list ⇒ Array<Samsara::Types::FormsMediaRecordObjectResponseBody> (readonly)

Returns List of media objects for the issue. Included if the issue has media.

Returns:



37
38
39
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 37

def media_list
  @media_list
end

#priority ⇒ Object (readonly)

values: low, medium, high



40
41
42
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 40

def priority
  @priority
end

#status ⇒ Object (readonly)

dismissed



43
44
45
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 43

def status
  @status
end

#submitted_at_time ⇒ DateTime (readonly)

Returns Submission time of the issue. UTC timestamp in RFC 3339 format.

Returns:

  • (DateTime) —

    Submission time of the issue. UTC timestamp in RFC 3339 format.



45
46
47
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 45

def 
  @submitted_at_time
end

#submitted_by ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBody (readonly)



47
48
49
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 47

def 
  @submitted_by
end

#title ⇒ String (readonly)

Returns Title of the issue.

Returns:

  • (String) —

    Title of the issue.



49
50
51
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 49

def title
  @title
end

#updated_at_time ⇒ DateTime (readonly)

Returns Update time of the issue. UTC timestamp in RFC 3339 format.

Returns:

  • (DateTime) —

    Update time of the issue. UTC timestamp in RFC 3339 format.



51
52
53
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 51

def updated_at_time
  @updated_at_time
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::IssueResponseObjectResponseBody

Parameters:

  • json_object (String)

Returns:



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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 105

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["asset"].nil?
    asset = parsed_json["asset"].to_json
    asset = Samsara::Types::FormsAssetObjectResponseBody.from_json(json_object: asset)
  else
    asset = nil
  end
  unless parsed_json["assignedTo"].nil?
    assigned_to = parsed_json["assignedTo"].to_json
    assigned_to = Samsara::Types::FormsPolymorphicUserObjectResponseBody.from_json(json_object: assigned_to)
  else
    assigned_to = nil
  end
  created_at_time = unless parsed_json["createdAtTime"].nil?
  DateTime.parse(parsed_json["createdAtTime"])
else
  nil
end
  description = parsed_json["description"]
  due_date = unless parsed_json["dueDate"].nil?
  DateTime.parse(parsed_json["dueDate"])
else
  nil
end
  external_ids = parsed_json["externalIds"]
  id = parsed_json["id"]
  unless parsed_json["issueSource"].nil?
    issue_source = parsed_json["issueSource"].to_json
    issue_source = Samsara::Types::IssueSourceObjectResponseBody.from_json(json_object: issue_source)
  else
    issue_source = nil
  end
  media_list = parsed_json["mediaList"]&.map do | item |
  item = item.to_json
  Samsara::Types::FormsMediaRecordObjectResponseBody.from_json(json_object: item)
end
  priority = parsed_json["priority"]
  status = parsed_json["status"]
   = unless parsed_json["submittedAtTime"].nil?
  DateTime.parse(parsed_json["submittedAtTime"])
else
  nil
end
  unless parsed_json["submittedBy"].nil?
     = parsed_json["submittedBy"].to_json
     = Samsara::Types::FormsPolymorphicUserObjectResponseBody.from_json(json_object: )
  else
     = nil
  end
  title = parsed_json["title"]
  updated_at_time = unless parsed_json["updatedAtTime"].nil?
  DateTime.parse(parsed_json["updatedAtTime"])
else
  nil
end
  new(
    asset: asset,
    assigned_to: assigned_to,
    created_at_time: created_at_time,
    description: description,
    due_date: due_date,
    external_ids: external_ids,
    id: id,
    issue_source: issue_source,
    media_list: media_list,
    priority: priority,
    status: status,
    submitted_at_time: ,
    submitted_by: ,
    title: title,
    updated_at_time: updated_at_time,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 193

def self.validate_raw(obj:)
  obj.asset.nil? || Samsara::Types::FormsAssetObjectResponseBody.validate_raw(obj: obj.asset)
  obj.assigned_to.nil? || Samsara::Types::FormsPolymorphicUserObjectResponseBody.validate_raw(obj: obj.assigned_to)
  obj.created_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.created_at_time 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.due_date&.is_a?(DateTime) != false || raise("Passed value for field obj.due_date is not the expected type, validation failed.")
  obj.external_ids&.is_a?(Hash) != false || raise("Passed value for field obj.external_ids is not the expected type, validation failed.")
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  Samsara::Types::IssueSourceObjectResponseBody.validate_raw(obj: obj.issue_source)
  obj.media_list&.is_a?(Array) != false || raise("Passed value for field obj.media_list is not the expected type, validation failed.")
  obj.priority&.is_a?(Samsara::Types::IssueResponseObjectResponseBodyPriority) != false || raise("Passed value for field obj.priority is not the expected type, validation failed.")
  obj.status.is_a?(Samsara::Types::IssueResponseObjectResponseBodyStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj..is_a?(DateTime) != false || raise("Passed value for field obj.submitted_at_time is not the expected type, validation failed.")
  Samsara::Types::FormsPolymorphicUserObjectResponseBody.validate_raw(obj: obj.)
  obj.title.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
  obj.updated_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at_time is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


184
185
186
# File 'lib/samsara_api/types/issue_response_object_response_body.rb', line 184

def to_json
  @_field_set&.to_json
end