Class: Merge::Ticketing::RemoteFieldApiResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket: OMIT, comment: OMIT, project: OMIT, collection: OMIT, user: OMIT, role: OMIT, account: OMIT, team: OMIT, attachment: OMIT, tag: OMIT, contact: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::RemoteFieldApiResponse

Parameters:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 53

def initialize(ticket: OMIT, comment: OMIT, project: OMIT, collection: OMIT, user: OMIT, role: OMIT,
               account: OMIT, team: OMIT, attachment: OMIT, tag: OMIT, contact: OMIT, additional_properties: nil)
  @ticket = ticket if ticket != OMIT
  @comment = comment if comment != OMIT
  @project = project if project != OMIT
  @collection = collection if collection != OMIT
  @user = user if user != OMIT
  @role = role if role != OMIT
  @account =  if  != OMIT
  @team = team if team != OMIT
  @attachment = attachment if attachment != OMIT
  @tag = tag if tag != OMIT
  @contact = contact if contact != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "Ticket": ticket,
    "Comment": comment,
    "Project": project,
    "Collection": collection,
    "User": user,
    "Role": role,
    "Account": ,
    "Team": team,
    "Attachment": attachment,
    "Tag": tag,
    "Contact": contact
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#accountArray<Merge::Ticketing::RemoteFieldApi> (readonly)



23
24
25
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 23

def 
  @account
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



33
34
35
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 33

def additional_properties
  @additional_properties
end

#attachmentArray<Merge::Ticketing::RemoteFieldApi> (readonly)



27
28
29
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 27

def attachment
  @attachment
end

#collectionArray<Merge::Ticketing::RemoteFieldApi> (readonly)



17
18
19
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 17

def collection
  @collection
end

#commentArray<Merge::Ticketing::RemoteFieldApi> (readonly)



13
14
15
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 13

def comment
  @comment
end

#contactArray<Merge::Ticketing::RemoteFieldApi> (readonly)



31
32
33
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 31

def contact
  @contact
end

#projectArray<Merge::Ticketing::RemoteFieldApi> (readonly)



15
16
17
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 15

def project
  @project
end

#roleArray<Merge::Ticketing::RemoteFieldApi> (readonly)



21
22
23
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 21

def role
  @role
end

#tagArray<Merge::Ticketing::RemoteFieldApi> (readonly)



29
30
31
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 29

def tag
  @tag
end

#teamArray<Merge::Ticketing::RemoteFieldApi> (readonly)



25
26
27
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 25

def team
  @team
end

#ticketArray<Merge::Ticketing::RemoteFieldApi> (readonly)



11
12
13
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 11

def ticket
  @ticket
end

#userArray<Merge::Ticketing::RemoteFieldApi> (readonly)



19
20
21
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 19

def user
  @user
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Ticketing::RemoteFieldApiResponse

Deserialize a JSON object to an instance of RemoteFieldApiResponse

Parameters:

  • json_object (String)

Returns:



88
89
90
91
92
93
94
95
96
97
98
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
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 88

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  ticket = parsed_json["Ticket"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  comment = parsed_json["Comment"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  project = parsed_json["Project"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  collection = parsed_json["Collection"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  user = parsed_json["User"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  role = parsed_json["Role"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
   = parsed_json["Account"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  team = parsed_json["Team"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  attachment = parsed_json["Attachment"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  tag = parsed_json["Tag"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  contact = parsed_json["Contact"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteFieldApi.from_json(json_object: item)
  end
  new(
    ticket: ticket,
    comment: comment,
    project: project,
    collection: collection,
    user: user,
    role: role,
    account: ,
    team: team,
    attachment: attachment,
    tag: tag,
    contact: contact,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 164

def self.validate_raw(obj:)
  obj.ticket&.is_a?(Array) != false || raise("Passed value for field obj.ticket is not the expected type, validation failed.")
  obj.comment&.is_a?(Array) != false || raise("Passed value for field obj.comment is not the expected type, validation failed.")
  obj.project&.is_a?(Array) != false || raise("Passed value for field obj.project is not the expected type, validation failed.")
  obj.collection&.is_a?(Array) != false || raise("Passed value for field obj.collection is not the expected type, validation failed.")
  obj.user&.is_a?(Array) != false || raise("Passed value for field obj.user is not the expected type, validation failed.")
  obj.role&.is_a?(Array) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
  obj.&.is_a?(Array) != false || raise("Passed value for field obj.account is not the expected type, validation failed.")
  obj.team&.is_a?(Array) != false || raise("Passed value for field obj.team is not the expected type, validation failed.")
  obj.attachment&.is_a?(Array) != false || raise("Passed value for field obj.attachment is not the expected type, validation failed.")
  obj.tag&.is_a?(Array) != false || raise("Passed value for field obj.tag is not the expected type, validation failed.")
  obj.contact&.is_a?(Array) != false || raise("Passed value for field obj.contact is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of RemoteFieldApiResponse to a JSON object

Returns:

  • (String)


154
155
156
# File 'lib/merge_ruby_client/ticketing/types/remote_field_api_response.rb', line 154

def to_json(*_args)
  @_field_set&.to_json
end