Class: Shipeasy::Admin::Generated::CreatePublicBugRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/shipeasy_admin/models/create_public_bug_request.rb

Overview

Body for POST /ops/bug. The same bug fields as CreateBugRequest, minus the type discriminator — the path already says what is being filed, plus the public intake's own dedupKey.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CreatePublicBugRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 159

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::CreatePublicBugRequest` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::CreatePublicBugRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'title')
    self.title = attributes[:'title']
  else
    self.title = nil
  end

  if attributes.key?(:'steps_to_reproduce')
    self.steps_to_reproduce = attributes[:'steps_to_reproduce']
  else
    self.steps_to_reproduce = ''
  end

  if attributes.key?(:'actual_result')
    self.actual_result = attributes[:'actual_result']
  else
    self.actual_result = ''
  end

  if attributes.key?(:'expected_result')
    self.expected_result = attributes[:'expected_result']
  else
    self.expected_result = ''
  end

  if attributes.key?(:'priority')
    self.priority = attributes[:'priority']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'assignee_id')
    self.assignee_id = attributes[:'assignee_id']
  end

  if attributes.key?(:'subscribers')
    if (value = attributes[:'subscribers']).is_a?(Array)
      self.subscribers = value
    end
  end

  if attributes.key?(:'tags')
    if (value = attributes[:'tags']).is_a?(Array)
      self.tags = value
    end
  end

  if attributes.key?(:'reporter_email')
    self.reporter_email = attributes[:'reporter_email']
  end

  if attributes.key?(:'page_url')
    self.page_url = attributes[:'page_url']
  end

  if attributes.key?(:'user_agent')
    self.user_agent = attributes[:'user_agent']
  end

  if attributes.key?(:'viewport')
    self.viewport = attributes[:'viewport']
  end

  if attributes.key?(:'context')
    if (value = attributes[:'context']).is_a?(Hash)
      self.context = value
    end
  end

  if attributes.key?(:'dedup_key')
    self.dedup_key = attributes[:'dedup_key']
  end

  if attributes.key?(:'notify')
    self.notify = attributes[:'notify']
  end
end

Instance Attribute Details

#actual_resultObject

What actually happened.



26
27
28
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 26

def actual_result
  @actual_result
end

#assignee_idObject

The users.id of the person to assign as owner at creation, or null.



38
39
40
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 38

def assignee_id
  @assignee_id
end

#contextObject

Arbitrary capture context, or null.



59
60
61
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 59

def context
  @context
end

#dedup_keyObject

Caller-chosen dedupe identity for this report, stored on the ticket. A repeat submission carrying the same key does NOT file a second ticket: the open ticket already holding that key is refreshed from this payload (title and the report fields overwritten, a "re-triggered" comment appended) and returned with deduped: true and updated: true. Triage state a human owns — status, priority, assignee, tags — is left untouched, and a resolved/wont_fix ticket no longer holds the key, so a failure that comes back after being closed files a fresh ticket. Omit it to fall back to the derived (title + context.step) dedupe, whose repeats return the existing ticket unchanged.



62
63
64
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 62

def dedup_key
  @dedup_key
end

#expected_resultObject

What was expected instead.



29
30
31
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 29

def expected_result
  @expected_result
end

#notifyObject

Where this bug's completion notification lands.



65
66
67
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 65

def notify
  @notify
end

#page_urlObject

URL of the page the bug relates to, or null.



50
51
52
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 50

def page_url
  @page_url
end

#priorityObject

Initial triage priority, or null.



32
33
34
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 32

def priority
  @priority
end

#reporter_emailObject

Email of the reporter, or null.



47
48
49
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 47

def reporter_email
  @reporter_email
end

#statusObject

Initial lifecycle status; defaults to open when omitted.



35
36
37
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 35

def status
  @status
end

#steps_to_reproduceObject

How to reproduce the bug.



23
24
25
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 23

def steps_to_reproduce
  @steps_to_reproduce
end

#subscribersObject

Emails of teammates to subscribe to this item's Slack pings at creation.



41
42
43
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 41

def subscribers
  @subscribers
end

#tagsObject

Tag names to attach at creation (get-or-created by name, deduped case-insensitively).



44
45
46
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 44

def tags
  @tags
end

#titleObject

One-line bug title (no leading/trailing whitespace).



20
21
22
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 20

def title
  @title
end

#user_agentObject

Reporter's user-agent string, or null.



53
54
55
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 53

def user_agent
  @user_agent
end

#viewportObject

Reporter's viewport (e.g. 1280x720), or null.



56
57
58
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 56

def viewport
  @viewport
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



112
113
114
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 112

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



117
118
119
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 117

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 90

def self.attribute_map
  {
    :'title' => :'title',
    :'steps_to_reproduce' => :'stepsToReproduce',
    :'actual_result' => :'actualResult',
    :'expected_result' => :'expectedResult',
    :'priority' => :'priority',
    :'status' => :'status',
    :'assignee_id' => :'assigneeId',
    :'subscribers' => :'subscribers',
    :'tags' => :'tags',
    :'reporter_email' => :'reporterEmail',
    :'page_url' => :'pageUrl',
    :'user_agent' => :'userAgent',
    :'viewport' => :'viewport',
    :'context' => :'context',
    :'dedup_key' => :'dedupKey',
    :'notify' => :'notify'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 455

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 144

def self.openapi_nullable
  Set.new([
    :'priority',
    :'assignee_id',
    :'reporter_email',
    :'page_url',
    :'user_agent',
    :'viewport',
    :'context',
    :'notify'
  ])
end

.openapi_typesObject

Attribute type mapping.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 122

def self.openapi_types
  {
    :'title' => :'String',
    :'steps_to_reproduce' => :'String',
    :'actual_result' => :'String',
    :'expected_result' => :'String',
    :'priority' => :'OpsItemPriority',
    :'status' => :'OpsItemStatus',
    :'assignee_id' => :'String',
    :'subscribers' => :'Array<String>',
    :'tags' => :'Array<String>',
    :'reporter_email' => :'String',
    :'page_url' => :'String',
    :'user_agent' => :'String',
    :'viewport' => :'String',
    :'context' => :'Hash<String, Object>',
    :'dedup_key' => :'String',
    :'notify' => :'NotificationTarget'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 419

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      title == o.title &&
      steps_to_reproduce == o.steps_to_reproduce &&
      actual_result == o.actual_result &&
      expected_result == o.expected_result &&
      priority == o.priority &&
      status == o.status &&
      assignee_id == o.assignee_id &&
      subscribers == o.subscribers &&
      tags == o.tags &&
      reporter_email == o.reporter_email &&
      page_url == o.page_url &&
      user_agent == o.user_agent &&
      viewport == o.viewport &&
      context == o.context &&
      dedup_key == o.dedup_key &&
      notify == o.notify
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


442
443
444
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 442

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



448
449
450
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 448

def hash
  [title, steps_to_reproduce, actual_result, expected_result, priority, status, assignee_id, subscribers, tags, reporter_email, page_url, user_agent, viewport, context, dedup_key, notify].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 254

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @title.nil?
    invalid_properties.push('invalid value for "title", title cannot be nil.')
  end

  if @title.to_s.length > 200
    invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 200.')
  end

  if @title.to_s.length < 1
    invalid_properties.push('invalid value for "title", the character length must be greater than or equal to 1.')
  end

  pattern = Regexp.new(/^\S(.*\S)?$/)
  if @title !~ pattern
    invalid_properties.push("invalid value for \"title\", must conform to the pattern #{pattern}.")
  end

  if !@steps_to_reproduce.nil? && @steps_to_reproduce.to_s.length > 8000
    invalid_properties.push('invalid value for "steps_to_reproduce", the character length must be smaller than or equal to 8000.')
  end

  if !@actual_result.nil? && @actual_result.to_s.length > 8000
    invalid_properties.push('invalid value for "actual_result", the character length must be smaller than or equal to 8000.')
  end

  if !@expected_result.nil? && @expected_result.to_s.length > 8000
    invalid_properties.push('invalid value for "expected_result", the character length must be smaller than or equal to 8000.')
  end

  if !@user_agent.nil? && @user_agent.to_s.length > 500
    invalid_properties.push('invalid value for "user_agent", the character length must be smaller than or equal to 500.')
  end

  if !@viewport.nil? && @viewport.to_s.length > 40
    invalid_properties.push('invalid value for "viewport", the character length must be smaller than or equal to 40.')
  end

  if !@dedup_key.nil? && @dedup_key.to_s.length > 200
    invalid_properties.push('invalid value for "dedup_key", the character length must be smaller than or equal to 200.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 477

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/shipeasy_admin/models/create_public_bug_request.rb', line 303

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @title.nil?
  return false if @title.to_s.length > 200
  return false if @title.to_s.length < 1
  return false if @title !~ Regexp.new(/^\S(.*\S)?$/)
  return false if !@steps_to_reproduce.nil? && @steps_to_reproduce.to_s.length > 8000
  return false if !@actual_result.nil? && @actual_result.to_s.length > 8000
  return false if !@expected_result.nil? && @expected_result.to_s.length > 8000
  return false if !@user_agent.nil? && @user_agent.to_s.length > 500
  return false if !@viewport.nil? && @viewport.to_s.length > 40
  return false if !@dedup_key.nil? && @dedup_key.to_s.length > 200
  true
end