Class: Spatio::Email
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Spatio::Email
- Defined in:
- lib/spatio-sdk/models/email.rb
Overview
A single email message. The ‘provider`/`accountId` provenance fields tell clients which connected mail account this row came from (Gmail, Outlook, etc.) so multi-account list responses can be merged sensibly client-side.
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#attachments ⇒ Object
Returns the value of attribute attachments.
-
#bcc ⇒ Object
Returns the value of attribute bcc.
-
#body ⇒ Object
Returns the value of attribute body.
-
#cc ⇒ Object
Returns the value of attribute cc.
-
#date ⇒ Object
Returns the value of attribute date.
-
#from ⇒ Object
Returns the value of attribute from.
-
#html ⇒ Object
‘true` when `body` contains HTML, `false` for plain text.
-
#id ⇒ Object
Returns the value of attribute id.
-
#in_reply_to ⇒ Object
RFC 5322 In-Reply-To header — the parent message id this message is a reply to.
-
#is_read ⇒ Object
Returns the value of attribute is_read.
-
#is_starred ⇒ Object
Returns the value of attribute is_starred.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#message_id ⇒ Object
RFC 5322 Message-ID header.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#references ⇒ Object
RFC 5322 References header (ancestor chain).
-
#snippet ⇒ Object
Returns the value of attribute snippet.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#thread_id ⇒ Object
Returns the value of attribute thread_id.
-
#to ⇒ Object
Returns the value of attribute to.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Email
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Email
Initializes the object
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 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 251 252 253 254 255 256 |
# File 'lib/spatio-sdk/models/email.rb', line 133 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Spatio::Email` 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 `Spatio::Email`. 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?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'thread_id') self.thread_id = attributes[:'thread_id'] end if attributes.key?(:'provider') self.provider = attributes[:'provider'] end if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end if attributes.key?(:'subject') self.subject = attributes[:'subject'] else self.subject = nil end if attributes.key?(:'from') self.from = attributes[:'from'] else self.from = nil end if attributes.key?(:'to') if (value = attributes[:'to']).is_a?(Array) self.to = value end else self.to = nil end if attributes.key?(:'cc') if (value = attributes[:'cc']).is_a?(Array) self.cc = value end end if attributes.key?(:'bcc') if (value = attributes[:'bcc']).is_a?(Array) self.bcc = value end end if attributes.key?(:'body') self.body = attributes[:'body'] else self.body = nil end if attributes.key?(:'html') self.html = attributes[:'html'] else self.html = nil end if attributes.key?(:'date') self.date = attributes[:'date'] else self.date = nil end if attributes.key?(:'labels') if (value = attributes[:'labels']).is_a?(Array) self.labels = value end end if attributes.key?(:'is_read') self.is_read = attributes[:'is_read'] else self.is_read = nil end if attributes.key?(:'is_starred') self.is_starred = attributes[:'is_starred'] else self.is_starred = nil end if attributes.key?(:'attachments') if (value = attributes[:'attachments']).is_a?(Array) self. = value end end if attributes.key?(:'snippet') self.snippet = attributes[:'snippet'] end if attributes.key?(:'message_id') self. = attributes[:'message_id'] end if attributes.key?(:'in_reply_to') self.in_reply_to = attributes[:'in_reply_to'] end if attributes.key?(:'references') if (value = attributes[:'references']).is_a?(Array) self.references = value end end end |
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
25 26 27 |
# File 'lib/spatio-sdk/models/email.rb', line 25 def account_id @account_id end |
#attachments ⇒ Object
Returns the value of attribute attachments.
50 51 52 |
# File 'lib/spatio-sdk/models/email.rb', line 50 def @attachments end |
#bcc ⇒ Object
Returns the value of attribute bcc.
35 36 37 |
# File 'lib/spatio-sdk/models/email.rb', line 35 def bcc @bcc end |
#body ⇒ Object
Returns the value of attribute body.
37 38 39 |
# File 'lib/spatio-sdk/models/email.rb', line 37 def body @body end |
#cc ⇒ Object
Returns the value of attribute cc.
33 34 35 |
# File 'lib/spatio-sdk/models/email.rb', line 33 def cc @cc end |
#date ⇒ Object
Returns the value of attribute date.
42 43 44 |
# File 'lib/spatio-sdk/models/email.rb', line 42 def date @date end |
#from ⇒ Object
Returns the value of attribute from.
29 30 31 |
# File 'lib/spatio-sdk/models/email.rb', line 29 def from @from end |
#html ⇒ Object
‘true` when `body` contains HTML, `false` for plain text.
40 41 42 |
# File 'lib/spatio-sdk/models/email.rb', line 40 def html @html end |
#id ⇒ Object
Returns the value of attribute id.
19 20 21 |
# File 'lib/spatio-sdk/models/email.rb', line 19 def id @id end |
#in_reply_to ⇒ Object
RFC 5322 In-Reply-To header — the parent message id this message is a reply to.
58 59 60 |
# File 'lib/spatio-sdk/models/email.rb', line 58 def in_reply_to @in_reply_to end |
#is_read ⇒ Object
Returns the value of attribute is_read.
46 47 48 |
# File 'lib/spatio-sdk/models/email.rb', line 46 def is_read @is_read end |
#is_starred ⇒ Object
Returns the value of attribute is_starred.
48 49 50 |
# File 'lib/spatio-sdk/models/email.rb', line 48 def is_starred @is_starred end |
#labels ⇒ Object
Returns the value of attribute labels.
44 45 46 |
# File 'lib/spatio-sdk/models/email.rb', line 44 def labels @labels end |
#message_id ⇒ Object
RFC 5322 Message-ID header.
55 56 57 |
# File 'lib/spatio-sdk/models/email.rb', line 55 def @message_id end |
#provider ⇒ Object
Returns the value of attribute provider.
23 24 25 |
# File 'lib/spatio-sdk/models/email.rb', line 23 def provider @provider end |
#references ⇒ Object
RFC 5322 References header (ancestor chain).
61 62 63 |
# File 'lib/spatio-sdk/models/email.rb', line 61 def references @references end |
#snippet ⇒ Object
Returns the value of attribute snippet.
52 53 54 |
# File 'lib/spatio-sdk/models/email.rb', line 52 def snippet @snippet end |
#subject ⇒ Object
Returns the value of attribute subject.
27 28 29 |
# File 'lib/spatio-sdk/models/email.rb', line 27 def subject @subject end |
#thread_id ⇒ Object
Returns the value of attribute thread_id.
21 22 23 |
# File 'lib/spatio-sdk/models/email.rb', line 21 def thread_id @thread_id end |
#to ⇒ Object
Returns the value of attribute to.
31 32 33 |
# File 'lib/spatio-sdk/models/email.rb', line 31 def to @to end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
90 91 92 |
# File 'lib/spatio-sdk/models/email.rb', line 90 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
95 96 97 |
# File 'lib/spatio-sdk/models/email.rb', line 95 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/spatio-sdk/models/email.rb', line 64 def self.attribute_map { :'id' => :'id', :'thread_id' => :'threadId', :'provider' => :'provider', :'account_id' => :'accountId', :'subject' => :'subject', :'from' => :'from', :'to' => :'to', :'cc' => :'cc', :'bcc' => :'bcc', :'body' => :'body', :'html' => :'html', :'date' => :'date', :'labels' => :'labels', :'is_read' => :'isRead', :'is_starred' => :'isStarred', :'attachments' => :'attachments', :'snippet' => :'snippet', :'message_id' => :'messageId', :'in_reply_to' => :'inReplyTo', :'references' => :'references' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/spatio-sdk/models/email.rb', line 450 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_nullable ⇒ Object
List of attributes with nullable: true
126 127 128 129 |
# File 'lib/spatio-sdk/models/email.rb', line 126 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/spatio-sdk/models/email.rb', line 100 def self.openapi_types { :'id' => :'String', :'thread_id' => :'String', :'provider' => :'String', :'account_id' => :'String', :'subject' => :'String', :'from' => :'String', :'to' => :'Array<String>', :'cc' => :'Array<String>', :'bcc' => :'Array<String>', :'body' => :'String', :'html' => :'Boolean', :'date' => :'Time', :'labels' => :'Array<String>', :'is_read' => :'Boolean', :'is_starred' => :'Boolean', :'attachments' => :'Array<AttachmentMeta>', :'snippet' => :'String', :'message_id' => :'String', :'in_reply_to' => :'String', :'references' => :'Array<String>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/spatio-sdk/models/email.rb', line 410 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && thread_id == o.thread_id && provider == o.provider && account_id == o.account_id && subject == o.subject && from == o.from && to == o.to && cc == o.cc && bcc == o.bcc && body == o.body && html == o.html && date == o.date && labels == o.labels && is_read == o.is_read && is_starred == o.is_starred && == o. && snippet == o.snippet && == o. && in_reply_to == o.in_reply_to && references == o.references end |
#eql?(o) ⇒ Boolean
437 438 439 |
# File 'lib/spatio-sdk/models/email.rb', line 437 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
443 444 445 |
# File 'lib/spatio-sdk/models/email.rb', line 443 def hash [id, thread_id, provider, account_id, subject, from, to, cc, bcc, body, html, date, labels, is_read, is_starred, , snippet, , in_reply_to, references].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 300 |
# File 'lib/spatio-sdk/models/email.rb', line 260 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @subject.nil? invalid_properties.push('invalid value for "subject", subject cannot be nil.') end if @from.nil? invalid_properties.push('invalid value for "from", from cannot be nil.') end if @to.nil? invalid_properties.push('invalid value for "to", to cannot be nil.') end if @body.nil? invalid_properties.push('invalid value for "body", body cannot be nil.') end if @html.nil? invalid_properties.push('invalid value for "html", html cannot be nil.') end if @date.nil? invalid_properties.push('invalid value for "date", date cannot be nil.') end if @is_read.nil? invalid_properties.push('invalid value for "is_read", is_read cannot be nil.') end if @is_starred.nil? invalid_properties.push('invalid value for "is_starred", is_starred cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File 'lib/spatio-sdk/models/email.rb', line 472 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
304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/spatio-sdk/models/email.rb', line 304 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @subject.nil? return false if @from.nil? return false if @to.nil? return false if @body.nil? return false if @html.nil? return false if @date.nil? return false if @is_read.nil? return false if @is_starred.nil? true end |