lockally 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -5
  3. data/docs/AgentSendResult.md +6 -2
  4. data/docs/MailboxGrant.md +7 -3
  5. data/docs/MailboxGrantList.md +2 -2
  6. data/docs/MarkReadResult.md +2 -0
  7. data/docs/SimulatedInbound.md +6 -0
  8. data/docs/ThreadClassification.md +2 -0
  9. data/docs/ThreadMessageBody.md +10 -26
  10. data/docs/{ThreadMessageBodyAllOfBody.md → ThreadMessageBodyBody.md} +2 -2
  11. data/docs/Whoami.md +7 -7
  12. data/docs/WhoamiKey.md +20 -0
  13. data/docs/WhoamiTenant.md +22 -0
  14. data/lib/lockally/models/agent_send_result.rb +72 -1
  15. data/lib/lockally/models/mailbox_grant.rb +28 -10
  16. data/lib/lockally/models/mailbox_grant_list.rb +17 -17
  17. data/lib/lockally/models/mark_read_result.rb +10 -1
  18. data/lib/lockally/models/simulated_inbound.rb +29 -1
  19. data/lib/lockally/models/thread_classification.rb +11 -1
  20. data/lib/lockally/models/thread_message_body.rb +58 -233
  21. data/lib/lockally/models/{thread_message_body_all_of_body.rb → thread_message_body_body.rb} +4 -3
  22. data/lib/lockally/models/whoami.rb +98 -24
  23. data/lib/lockally/models/whoami_key.rb +157 -0
  24. data/lib/lockally/models/whoami_tenant.rb +166 -0
  25. data/lib/lockally/version.rb +1 -1
  26. data/lib/lockally.rb +3 -1
  27. data/spec/models/agent_send_result_spec.rb +12 -0
  28. data/spec/models/mailbox_grant_list_spec.rb +1 -1
  29. data/spec/models/mailbox_grant_spec.rb +13 -1
  30. data/spec/models/mark_read_result_spec.rb +6 -0
  31. data/spec/models/simulated_inbound_spec.rb +18 -0
  32. data/spec/models/thread_classification_spec.rb +6 -0
  33. data/spec/models/{thread_message_body_all_of_body_spec.rb → thread_message_body_body_spec.rb} +6 -6
  34. data/spec/models/thread_message_body_spec.rb +5 -57
  35. data/spec/models/whoami_key_spec.rb +42 -0
  36. data/spec/models/whoami_spec.rb +8 -4
  37. data/spec/models/whoami_tenant_spec.rb +48 -0
  38. metadata +13 -5
@@ -15,17 +15,27 @@ require 'time'
15
15
 
16
16
  module Lockally
17
17
  class SimulatedInbound < ApiModelBase
18
+ attr_accessor :simulated
19
+
20
+ # True when the message was adopted into a thread.
21
+ attr_accessor :indexed
22
+
18
23
  attr_accessor :thread_id
19
24
 
20
25
  attr_accessor :message_id
21
26
 
27
+ attr_accessor :rfc_message_id
28
+
22
29
  attr_accessor :annotations
23
30
 
24
31
  # Attribute mapping from ruby-style variable name to JSON key.
25
32
  def self.attribute_map
26
33
  {
34
+ :'simulated' => :'simulated',
35
+ :'indexed' => :'indexed',
27
36
  :'thread_id' => :'thread_id',
28
37
  :'message_id' => :'message_id',
38
+ :'rfc_message_id' => :'rfc_message_id',
29
39
  :'annotations' => :'annotations'
30
40
  }
31
41
  end
@@ -43,8 +53,11 @@ module Lockally
43
53
  # Attribute type mapping.
44
54
  def self.openapi_types
45
55
  {
56
+ :'simulated' => :'Boolean',
57
+ :'indexed' => :'Boolean',
46
58
  :'thread_id' => :'String',
47
59
  :'message_id' => :'String',
60
+ :'rfc_message_id' => :'String',
48
61
  :'annotations' => :'Annotations'
49
62
  }
50
63
  end
@@ -71,6 +84,14 @@ module Lockally
71
84
  h[k.to_sym] = v
72
85
  }
73
86
 
87
+ if attributes.key?(:'simulated')
88
+ self.simulated = attributes[:'simulated']
89
+ end
90
+
91
+ if attributes.key?(:'indexed')
92
+ self.indexed = attributes[:'indexed']
93
+ end
94
+
74
95
  if attributes.key?(:'thread_id')
75
96
  self.thread_id = attributes[:'thread_id']
76
97
  end
@@ -79,6 +100,10 @@ module Lockally
79
100
  self.message_id = attributes[:'message_id']
80
101
  end
81
102
 
103
+ if attributes.key?(:'rfc_message_id')
104
+ self.rfc_message_id = attributes[:'rfc_message_id']
105
+ end
106
+
82
107
  if attributes.key?(:'annotations')
83
108
  self.annotations = attributes[:'annotations']
84
109
  end
@@ -104,8 +129,11 @@ module Lockally
104
129
  def ==(o)
105
130
  return true if self.equal?(o)
106
131
  self.class == o.class &&
132
+ simulated == o.simulated &&
133
+ indexed == o.indexed &&
107
134
  thread_id == o.thread_id &&
108
135
  message_id == o.message_id &&
136
+ rfc_message_id == o.rfc_message_id &&
109
137
  annotations == o.annotations
110
138
  end
111
139
 
@@ -118,7 +146,7 @@ module Lockally
118
146
  # Calculates hash code according to all attributes.
119
147
  # @return [Integer] Hash code
120
148
  def hash
121
- [thread_id, message_id, annotations].hash
149
+ [simulated, indexed, thread_id, message_id, rfc_message_id, annotations].hash
122
150
  end
123
151
 
124
152
  # Builds the object from hash
@@ -20,6 +20,9 @@ module Lockally
20
20
  # True when a previous classification was reused.
21
21
  attr_accessor :cached
22
22
 
23
+ # True when this call consumed an AI unit.
24
+ attr_accessor :billed
25
+
23
26
  attr_accessor :classification
24
27
 
25
28
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -27,6 +30,7 @@ module Lockally
27
30
  {
28
31
  :'thread_id' => :'thread_id',
29
32
  :'cached' => :'cached',
33
+ :'billed' => :'billed',
30
34
  :'classification' => :'classification'
31
35
  }
32
36
  end
@@ -46,6 +50,7 @@ module Lockally
46
50
  {
47
51
  :'thread_id' => :'String',
48
52
  :'cached' => :'Boolean',
53
+ :'billed' => :'Boolean',
49
54
  :'classification' => :'Classification'
50
55
  }
51
56
  end
@@ -82,6 +87,10 @@ module Lockally
82
87
  self.cached = attributes[:'cached']
83
88
  end
84
89
 
90
+ if attributes.key?(:'billed')
91
+ self.billed = attributes[:'billed']
92
+ end
93
+
85
94
  if attributes.key?(:'classification')
86
95
  self.classification = attributes[:'classification']
87
96
  end
@@ -124,6 +133,7 @@ module Lockally
124
133
  self.class == o.class &&
125
134
  thread_id == o.thread_id &&
126
135
  cached == o.cached &&
136
+ billed == o.billed &&
127
137
  classification == o.classification
128
138
  end
129
139
 
@@ -136,7 +146,7 @@ module Lockally
136
146
  # Calculates hash code according to all attributes.
137
147
  # @return [Integer] Hash code
138
148
  def hash
139
- [thread_id, cached, classification].hash
149
+ [thread_id, cached, billed, classification].hash
140
150
  end
141
151
 
142
152
  # Builds the object from hash
@@ -15,71 +15,25 @@ require 'time'
15
15
 
16
16
  module Lockally
17
17
  class ThreadMessageBody < ApiModelBase
18
- attr_accessor :id
18
+ attr_accessor :thread_id
19
19
 
20
- attr_accessor :direction
20
+ attr_accessor :mailbox
21
21
 
22
- # The Internet Message-ID
23
- attr_accessor :rfc_message_id
24
-
25
- attr_accessor :in_reply_to
26
-
27
- attr_accessor :subject
28
-
29
- attr_accessor :from
30
-
31
- attr_accessor :to
32
-
33
- attr_accessor :snippet
34
-
35
- attr_accessor :has_attachments
36
-
37
- attr_accessor :attachments
38
-
39
- attr_accessor :annotations
40
-
41
- attr_accessor :received_at
22
+ attr_accessor :message
42
23
 
43
24
  attr_accessor :body
44
25
 
45
- class EnumAttributeValidator
46
- attr_reader :datatype
47
- attr_reader :allowable_values
48
-
49
- def initialize(datatype, allowable_values)
50
- @allowable_values = allowable_values.map do |value|
51
- case datatype.to_s
52
- when /Integer/i
53
- value.to_i
54
- when /Float/i
55
- value.to_f
56
- else
57
- value
58
- end
59
- end
60
- end
61
-
62
- def valid?(value)
63
- !value || allowable_values.include?(value)
64
- end
65
- end
26
+ # Present instead of body when the message could not be located in the mailbox.
27
+ attr_accessor :body_unavailable
66
28
 
67
29
  # Attribute mapping from ruby-style variable name to JSON key.
68
30
  def self.attribute_map
69
31
  {
70
- :'id' => :'id',
71
- :'direction' => :'direction',
72
- :'rfc_message_id' => :'rfc_message_id',
73
- :'in_reply_to' => :'in_reply_to',
74
- :'subject' => :'subject',
75
- :'from' => :'from',
76
- :'to' => :'to',
77
- :'snippet' => :'snippet',
78
- :'has_attachments' => :'has_attachments',
79
- :'attachments' => :'attachments',
80
- :'annotations' => :'annotations',
81
- :'received_at' => :'received_at',
82
- :'body' => :'body'
32
+ :'thread_id' => :'thread_id',
33
+ :'mailbox' => :'mailbox',
34
+ :'message' => :'message',
35
+ :'body' => :'body',
36
+ :'body_unavailable' => :'body_unavailable'
83
37
  }
84
38
  end
85
39
 
@@ -96,19 +50,11 @@ module Lockally
96
50
  # Attribute type mapping.
97
51
  def self.openapi_types
98
52
  {
99
- :'id' => :'String',
100
- :'direction' => :'String',
101
- :'rfc_message_id' => :'String',
102
- :'in_reply_to' => :'String',
103
- :'subject' => :'String',
104
- :'from' => :'String',
105
- :'to' => :'Array<String>',
106
- :'snippet' => :'String',
107
- :'has_attachments' => :'Boolean',
108
- :'attachments' => :'Array<Attachment>',
109
- :'annotations' => :'Annotations',
110
- :'received_at' => :'Time',
111
- :'body' => :'ThreadMessageBodyAllOfBody'
53
+ :'thread_id' => :'String',
54
+ :'mailbox' => :'String',
55
+ :'message' => :'ThreadMessage',
56
+ :'body' => :'ThreadMessageBodyBody',
57
+ :'body_unavailable' => :'String'
112
58
  }
113
59
  end
114
60
 
@@ -118,13 +64,6 @@ module Lockally
118
64
  ])
119
65
  end
120
66
 
121
- # List of class defined in allOf (OpenAPI v3)
122
- def self.openapi_all_of
123
- [
124
- :'ThreadMessage'
125
- ]
126
- end
127
-
128
67
  # Initializes the object
129
68
  # @param [Hash] attributes Model attributes in the form of hash
130
69
  def initialize(attributes = {})
@@ -141,75 +80,31 @@ module Lockally
141
80
  h[k.to_sym] = v
142
81
  }
143
82
 
144
- if attributes.key?(:'id')
145
- self.id = attributes[:'id']
83
+ if attributes.key?(:'thread_id')
84
+ self.thread_id = attributes[:'thread_id']
146
85
  else
147
- self.id = nil
86
+ self.thread_id = nil
148
87
  end
149
88
 
150
- if attributes.key?(:'direction')
151
- self.direction = attributes[:'direction']
89
+ if attributes.key?(:'mailbox')
90
+ self.mailbox = attributes[:'mailbox']
152
91
  else
153
- self.direction = nil
92
+ self.mailbox = nil
154
93
  end
155
94
 
156
- if attributes.key?(:'rfc_message_id')
157
- self.rfc_message_id = attributes[:'rfc_message_id']
95
+ if attributes.key?(:'message')
96
+ self.message = attributes[:'message']
158
97
  else
159
- self.rfc_message_id = nil
160
- end
161
-
162
- if attributes.key?(:'in_reply_to')
163
- self.in_reply_to = attributes[:'in_reply_to']
164
- end
165
-
166
- if attributes.key?(:'subject')
167
- self.subject = attributes[:'subject']
168
- end
169
-
170
- if attributes.key?(:'from')
171
- self.from = attributes[:'from']
172
- else
173
- self.from = nil
174
- end
175
-
176
- if attributes.key?(:'to')
177
- if (value = attributes[:'to']).is_a?(Array)
178
- self.to = value
179
- end
180
- else
181
- self.to = nil
182
- end
183
-
184
- if attributes.key?(:'snippet')
185
- self.snippet = attributes[:'snippet']
186
- end
187
-
188
- if attributes.key?(:'has_attachments')
189
- self.has_attachments = attributes[:'has_attachments']
190
- else
191
- self.has_attachments = nil
192
- end
193
-
194
- if attributes.key?(:'attachments')
195
- if (value = attributes[:'attachments']).is_a?(Array)
196
- self.attachments = value
197
- end
198
- end
199
-
200
- if attributes.key?(:'annotations')
201
- self.annotations = attributes[:'annotations']
202
- end
203
-
204
- if attributes.key?(:'received_at')
205
- self.received_at = attributes[:'received_at']
206
- else
207
- self.received_at = nil
98
+ self.message = nil
208
99
  end
209
100
 
210
101
  if attributes.key?(:'body')
211
102
  self.body = attributes[:'body']
212
103
  end
104
+
105
+ if attributes.key?(:'body_unavailable')
106
+ self.body_unavailable = attributes[:'body_unavailable']
107
+ end
213
108
  end
214
109
 
215
110
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -217,32 +112,16 @@ module Lockally
217
112
  def list_invalid_properties
218
113
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
219
114
  invalid_properties = Array.new
220
- if @id.nil?
221
- invalid_properties.push('invalid value for "id", id cannot be nil.')
115
+ if @thread_id.nil?
116
+ invalid_properties.push('invalid value for "thread_id", thread_id cannot be nil.')
222
117
  end
223
118
 
224
- if @direction.nil?
225
- invalid_properties.push('invalid value for "direction", direction cannot be nil.')
119
+ if @mailbox.nil?
120
+ invalid_properties.push('invalid value for "mailbox", mailbox cannot be nil.')
226
121
  end
227
122
 
228
- if @rfc_message_id.nil?
229
- invalid_properties.push('invalid value for "rfc_message_id", rfc_message_id cannot be nil.')
230
- end
231
-
232
- if @from.nil?
233
- invalid_properties.push('invalid value for "from", from cannot be nil.')
234
- end
235
-
236
- if @to.nil?
237
- invalid_properties.push('invalid value for "to", to cannot be nil.')
238
- end
239
-
240
- if @has_attachments.nil?
241
- invalid_properties.push('invalid value for "has_attachments", has_attachments cannot be nil.')
242
- end
243
-
244
- if @received_at.nil?
245
- invalid_properties.push('invalid value for "received_at", received_at cannot be nil.')
123
+ if @message.nil?
124
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
246
125
  end
247
126
 
248
127
  invalid_properties
@@ -252,86 +131,40 @@ module Lockally
252
131
  # @return true if the model is valid
253
132
  def valid?
254
133
  warn '[DEPRECATED] the `valid?` method is obsolete'
255
- return false if @id.nil?
256
- return false if @direction.nil?
257
- direction_validator = EnumAttributeValidator.new('String', ["inbound", "outbound"])
258
- return false unless direction_validator.valid?(@direction)
259
- return false if @rfc_message_id.nil?
260
- return false if @from.nil?
261
- return false if @to.nil?
262
- return false if @has_attachments.nil?
263
- return false if @received_at.nil?
134
+ return false if @thread_id.nil?
135
+ return false if @mailbox.nil?
136
+ return false if @message.nil?
264
137
  true
265
138
  end
266
139
 
267
140
  # Custom attribute writer method with validation
268
- # @param [Object] id Value to be assigned
269
- def id=(id)
270
- if id.nil?
271
- fail ArgumentError, 'id cannot be nil'
272
- end
273
-
274
- @id = id
275
- end
276
-
277
- # Custom attribute writer method checking allowed values (enum).
278
- # @param [Object] direction Object to be assigned
279
- def direction=(direction)
280
- validator = EnumAttributeValidator.new('String', ["inbound", "outbound"])
281
- unless validator.valid?(direction)
282
- fail ArgumentError, "invalid value for \"direction\", must be one of #{validator.allowable_values}."
283
- end
284
- @direction = direction
285
- end
286
-
287
- # Custom attribute writer method with validation
288
- # @param [Object] rfc_message_id Value to be assigned
289
- def rfc_message_id=(rfc_message_id)
290
- if rfc_message_id.nil?
291
- fail ArgumentError, 'rfc_message_id cannot be nil'
292
- end
293
-
294
- @rfc_message_id = rfc_message_id
295
- end
296
-
297
- # Custom attribute writer method with validation
298
- # @param [Object] from Value to be assigned
299
- def from=(from)
300
- if from.nil?
301
- fail ArgumentError, 'from cannot be nil'
302
- end
303
-
304
- @from = from
305
- end
306
-
307
- # Custom attribute writer method with validation
308
- # @param [Object] to Value to be assigned
309
- def to=(to)
310
- if to.nil?
311
- fail ArgumentError, 'to cannot be nil'
141
+ # @param [Object] thread_id Value to be assigned
142
+ def thread_id=(thread_id)
143
+ if thread_id.nil?
144
+ fail ArgumentError, 'thread_id cannot be nil'
312
145
  end
313
146
 
314
- @to = to
147
+ @thread_id = thread_id
315
148
  end
316
149
 
317
150
  # Custom attribute writer method with validation
318
- # @param [Object] has_attachments Value to be assigned
319
- def has_attachments=(has_attachments)
320
- if has_attachments.nil?
321
- fail ArgumentError, 'has_attachments cannot be nil'
151
+ # @param [Object] mailbox Value to be assigned
152
+ def mailbox=(mailbox)
153
+ if mailbox.nil?
154
+ fail ArgumentError, 'mailbox cannot be nil'
322
155
  end
323
156
 
324
- @has_attachments = has_attachments
157
+ @mailbox = mailbox
325
158
  end
326
159
 
327
160
  # Custom attribute writer method with validation
328
- # @param [Object] received_at Value to be assigned
329
- def received_at=(received_at)
330
- if received_at.nil?
331
- fail ArgumentError, 'received_at cannot be nil'
161
+ # @param [Object] message Value to be assigned
162
+ def message=(message)
163
+ if message.nil?
164
+ fail ArgumentError, 'message cannot be nil'
332
165
  end
333
166
 
334
- @received_at = received_at
167
+ @message = message
335
168
  end
336
169
 
337
170
  # Checks equality by comparing each attribute.
@@ -339,19 +172,11 @@ module Lockally
339
172
  def ==(o)
340
173
  return true if self.equal?(o)
341
174
  self.class == o.class &&
342
- id == o.id &&
343
- direction == o.direction &&
344
- rfc_message_id == o.rfc_message_id &&
345
- in_reply_to == o.in_reply_to &&
346
- subject == o.subject &&
347
- from == o.from &&
348
- to == o.to &&
349
- snippet == o.snippet &&
350
- has_attachments == o.has_attachments &&
351
- attachments == o.attachments &&
352
- annotations == o.annotations &&
353
- received_at == o.received_at &&
354
- body == o.body
175
+ thread_id == o.thread_id &&
176
+ mailbox == o.mailbox &&
177
+ message == o.message &&
178
+ body == o.body &&
179
+ body_unavailable == o.body_unavailable
355
180
  end
356
181
 
357
182
  # @see the `==` method
@@ -363,7 +188,7 @@ module Lockally
363
188
  # Calculates hash code according to all attributes.
364
189
  # @return [Integer] Hash code
365
190
  def hash
366
- [id, direction, rfc_message_id, in_reply_to, subject, from, to, snippet, has_attachments, attachments, annotations, received_at, body].hash
191
+ [thread_id, mailbox, message, body, body_unavailable].hash
367
192
  end
368
193
 
369
194
  # Builds the object from hash
@@ -14,7 +14,8 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Lockally
17
- class ThreadMessageBodyAllOfBody < ApiModelBase
17
+ # Absent when the stored message could not be fetched.
18
+ class ThreadMessageBodyBody < ApiModelBase
18
19
  attr_accessor :text
19
20
 
20
21
  attr_accessor :html
@@ -59,14 +60,14 @@ module Lockally
59
60
  # @param [Hash] attributes Model attributes in the form of hash
60
61
  def initialize(attributes = {})
61
62
  if (!attributes.is_a?(Hash))
62
- fail ArgumentError, "The input argument (attributes) must be a hash in `Lockally::ThreadMessageBodyAllOfBody` initialize method"
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Lockally::ThreadMessageBodyBody` initialize method"
63
64
  end
64
65
 
65
66
  # check to see if the attribute exists and convert string to symbol for hash key
66
67
  acceptable_attribute_map = self.class.acceptable_attribute_map
67
68
  attributes = attributes.each_with_object({}) { |(k, v), h|
68
69
  if (!acceptable_attribute_map.key?(k.to_sym))
69
- fail ArgumentError, "`#{k}` is not a valid attribute in `Lockally::ThreadMessageBodyAllOfBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Lockally::ThreadMessageBodyBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
71
  end
71
72
  h[k.to_sym] = v
72
73
  }