Class: Sendpost::UpdateWebhook
- Inherits:
-
Object
- Object
- Sendpost::UpdateWebhook
- Defined in:
- lib/sendpost_ruby_sdk/models/update_webhook.rb
Overview
Request body for updating an existing webhook. All fields are optional - only include fields you want to change.
Instance Attribute Summary collapse
-
#clicked ⇒ Object
Fire when a link is clicked.
-
#delivered ⇒ Object
Fire when email is accepted by recipient's mail server.
-
#dropped ⇒ Object
Fire when email is not sent (suppression, invalid, etc.).
-
#enabled ⇒ Object
Whether the webhook is active immediately after creation.
-
#hard_bounced ⇒ Object
Fire on permanent delivery failure.
-
#opened ⇒ Object
Fire when email is opened.
-
#processed ⇒ Object
Fire when email is accepted by SendPost API.
-
#sent ⇒ Object
Fire when email is sent to recipient's mail server.
-
#smtp_dropped ⇒ Object
Fire when email is rejected at SMTP level.
-
#soft_bounced ⇒ Object
Fire on temporary delivery failure (will retry).
-
#spam ⇒ Object
Fire when recipient marks email as spam.
-
#unique_click ⇒ Object
Fire only on FIRST click of each email (unique clicks).
-
#unique_open ⇒ Object
Fire only on FIRST open of each email (unique opens).
-
#unsubscribed ⇒ Object
Fire when recipient clicks unsubscribe link.
-
#url ⇒ Object
HTTPS URL endpoint to receive webhook POST requests.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.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_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.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.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ UpdateWebhook
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ UpdateWebhook
Initializes the object
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 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 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 131 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Sendpost::UpdateWebhook` 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 `Sendpost::UpdateWebhook`. 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?(:'enabled') self.enabled = attributes[:'enabled'] else self.enabled = true end if attributes.key?(:'url') self.url = attributes[:'url'] else self.url = nil end if attributes.key?(:'processed') self.processed = attributes[:'processed'] else self.processed = false end if attributes.key?(:'sent') self.sent = attributes[:'sent'] else self.sent = false end if attributes.key?(:'delivered') self.delivered = attributes[:'delivered'] else self.delivered = true end if attributes.key?(:'dropped') self.dropped = attributes[:'dropped'] else self.dropped = true end if attributes.key?(:'smtp_dropped') self.smtp_dropped = attributes[:'smtp_dropped'] else self.smtp_dropped = false end if attributes.key?(:'soft_bounced') self.soft_bounced = attributes[:'soft_bounced'] else self.soft_bounced = true end if attributes.key?(:'hard_bounced') self.hard_bounced = attributes[:'hard_bounced'] else self.hard_bounced = true end if attributes.key?(:'opened') self.opened = attributes[:'opened'] else self.opened = true end if attributes.key?(:'clicked') self.clicked = attributes[:'clicked'] else self.clicked = true end if attributes.key?(:'unsubscribed') self.unsubscribed = attributes[:'unsubscribed'] else self.unsubscribed = true end if attributes.key?(:'spam') self.spam = attributes[:'spam'] else self.spam = true end if attributes.key?(:'unique_open') self.unique_open = attributes[:'unique_open'] else self.unique_open = false end if attributes.key?(:'unique_click') self.unique_click = attributes[:'unique_click'] else self.unique_click = false end end |
Instance Attribute Details
#clicked ⇒ Object
Fire when a link is clicked. Fires on EVERY click. Consider using uniqueClick instead to reduce volume.
50 51 52 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 50 def clicked @clicked end |
#delivered ⇒ Object
Fire when email is accepted by recipient's mail server
32 33 34 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 32 def delivered @delivered end |
#dropped ⇒ Object
Fire when email is not sent (suppression, invalid, etc.)
35 36 37 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 35 def dropped @dropped end |
#enabled ⇒ Object
Whether the webhook is active immediately after creation. Set to false to configure and test before activating.
20 21 22 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 20 def enabled @enabled end |
#hard_bounced ⇒ Object
Fire on permanent delivery failure
44 45 46 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 44 def hard_bounced @hard_bounced end |
#opened ⇒ Object
Fire when email is opened. Fires on EVERY open. Consider using uniqueOpen instead to reduce volume.
47 48 49 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 47 def opened @opened end |
#processed ⇒ Object
Fire when email is accepted by SendPost API
26 27 28 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 26 def processed @processed end |
#sent ⇒ Object
Fire when email is sent to recipient's mail server
29 30 31 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 29 def sent @sent end |
#smtp_dropped ⇒ Object
Fire when email is rejected at SMTP level
38 39 40 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 38 def smtp_dropped @smtp_dropped end |
#soft_bounced ⇒ Object
Fire on temporary delivery failure (will retry)
41 42 43 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 41 def soft_bounced @soft_bounced end |
#spam ⇒ Object
Fire when recipient marks email as spam
56 57 58 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 56 def spam @spam end |
#unique_click ⇒ Object
Fire only on FIRST click of each email (unique clicks). More efficient than clicked if you only need engagement metrics.
62 63 64 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 62 def unique_click @unique_click end |
#unique_open ⇒ Object
Fire only on FIRST open of each email (unique opens). More efficient than opened if you only need engagement metrics.
59 60 61 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 59 def unique_open @unique_open end |
#unsubscribed ⇒ Object
Fire when recipient clicks unsubscribe link
53 54 55 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 53 def unsubscribed @unsubscribed end |
#url ⇒ Object
HTTPS URL endpoint to receive webhook POST requests. Must: - Use HTTPS (HTTP not allowed for security) - Be publicly accessible - Return 2xx status within 10 seconds - Handle duplicate deliveries (use eventId for idempotency)
23 24 25 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 23 def url @url end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 327 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Sendpost.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
86 87 88 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 86 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
91 92 93 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 91 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 65 def self.attribute_map { :'enabled' => :'enabled', :'url' => :'url', :'processed' => :'processed', :'sent' => :'sent', :'delivered' => :'delivered', :'dropped' => :'dropped', :'smtp_dropped' => :'smtpDropped', :'soft_bounced' => :'softBounced', :'hard_bounced' => :'hardBounced', :'opened' => :'opened', :'clicked' => :'clicked', :'unsubscribed' => :'unsubscribed', :'spam' => :'spam', :'unique_open' => :'uniqueOpen', :'unique_click' => :'uniqueClick' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 303 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_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
123 124 125 126 127 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 123 def self.openapi_all_of [ :'NewWebhook' ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
117 118 119 120 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 117 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 96 def self.openapi_types { :'enabled' => :'Boolean', :'url' => :'String', :'processed' => :'Boolean', :'sent' => :'Boolean', :'delivered' => :'Boolean', :'dropped' => :'Boolean', :'smtp_dropped' => :'Boolean', :'soft_bounced' => :'Boolean', :'hard_bounced' => :'Boolean', :'opened' => :'Boolean', :'clicked' => :'Boolean', :'unsubscribed' => :'Boolean', :'spam' => :'Boolean', :'unique_open' => :'Boolean', :'unique_click' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 268 def ==(o) return true if self.equal?(o) self.class == o.class && enabled == o.enabled && url == o.url && processed == o.processed && sent == o.sent && delivered == o.delivered && dropped == o.dropped && smtp_dropped == o.smtp_dropped && soft_bounced == o.soft_bounced && hard_bounced == o.hard_bounced && opened == o.opened && clicked == o.clicked && unsubscribed == o.unsubscribed && spam == o.spam && unique_open == o.unique_open && unique_click == o.unique_click end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 398 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
290 291 292 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 290 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
296 297 298 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 296 def hash [enabled, url, processed, sent, delivered, dropped, smtp_dropped, soft_bounced, hard_bounced, opened, clicked, unsubscribed, spam, unique_open, unique_click].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
238 239 240 241 242 243 244 245 246 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 238 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @url.nil? invalid_properties.push('invalid value for "url", url cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
374 375 376 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 374 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 380 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 |
#to_s ⇒ String
Returns the string representation of the object
368 369 370 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 368 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
250 251 252 253 254 |
# File 'lib/sendpost_ruby_sdk/models/update_webhook.rb', line 250 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @url.nil? true end |