Class: ConstantContactClient::GetEmailCampaignActivity200ResponseDocumentProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb

Overview

An object that contains optional properties for legacy format type emails (format_type 1 and 2). If you attempt to add a property that does apply to the email format_type, the API will ignore the property.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GetEmailCampaignActivity200ResponseDocumentProperties

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 119

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

If true, when the user forwards an email message the footer includes a link for subscribing to the list. If false, when a user forwards an email message the footer does not include a link for subscribing to the list. By default, the value is false. This property applies to format_type 1 and 2.



59
60
61
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 59

def forward_email_link_enabled
  @forward_email_link_enabled
end

The text displayed as the name for the forward email link in the footer when a user forwards an email. This property applies to format_type 1 and 2.



62
63
64
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 62

def forward_email_link_name
  @forward_email_link_name
end

#greeting_name_typeObject

The type of name the campaign uses to greet the contact. Valid values are F (First Name), L (Last Name), B (First and Last Name), or N (No greeting). By default, the value is N. This property applies only to format_type 1.



29
30
31
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 29

def greeting_name_type
  @greeting_name_type
end

#greeting_salutationObject

The greeting used in the email message. This property applies only to format_type 1.



26
27
28
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 26

def greeting_salutation
  @greeting_salutation
end

#greeting_secondaryObject

A fallback text string the campaign uses to greet the contact when the greeting_name_type is not available or set to N. This property applies only to format_type 1.



32
33
34
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 32

def greeting_secondary
  @greeting_secondary
end

#letter_formatObject

Email message format. Valid values are HTML and XHTML. By default, the value is HTML. For more information, see the <a href="http://www.constantcontact.com/display_media.jsp?id=87" target="_blank">Advanced Editor User's Guide. This property applies only to format_type 1. You cannot change this property after you create an email.



23
24
25
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 23

def letter_format
  @letter_format
end

#permission_reminderObject

The message text Constant Contact displays at the top of the email message to remind users that they are subscribed to an email list. This property applies to format_type 1 and 2.



47
48
49
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 47

def permission_reminder
  @permission_reminder
end

#permission_reminder_enabledObject

If true, Constant Contact displays your permission_reminder message to contacts at top of the email. If false, Constant Contact does not display the message. By default, the value is false. This property applies to format_type 1 and 2.



44
45
46
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 44

def permission_reminder_enabled
  @permission_reminder_enabled
end

#style_contentObject

Contains style sheet elements for XHTML letter format emails. This property applies only to format_type 1.



20
21
22
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 20

def style_content
  @style_content
end

If true, the email footer includes a link for subscribing to the list. If false, the message footer does not include a link for subscribing to the list. By default, the value is false. This property applies only to format_type 1.



35
36
37
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 35

def subscribe_link_enabled
  @subscribe_link_enabled
end

The text displayed as the name for the subscribe link in the email footer. This property applies only to format_type 1.



38
39
40
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 38

def subscribe_link_name
  @subscribe_link_name
end

#text_contentObject

Contains the text content that Constant Contact displays to contacts when their email client cannot display HTML email. If you do not specify text content, Constant Contact displays "Greetings!" as the text content. This property applies only to format_type 1.



41
42
43
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 41

def text_content
  @text_content
end

#view_as_webpage_enabledObject

If true, Constant Contact displays the view as web page email message. If false Constant Contact does not display the message. By default, the value is false. This property applies to format_type 1 and 2.



50
51
52
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 50

def view_as_webpage_enabled
  @view_as_webpage_enabled
end

The name of the link that users can click to view the email as a web page. This property applies to format_type 1 and 2.



56
57
58
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 56

def view_as_webpage_link_name
  @view_as_webpage_link_name
end

#view_as_webpage_textObject

The text Constant Contact displays before the view as web page link at the top of the email. This property applies to format_type 1 and 2.



53
54
55
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 53

def view_as_webpage_text
  @view_as_webpage_text
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 433

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 = ConstantContactClient.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_attributesObject

Returns all the JSON keys this model knows about



86
87
88
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 86

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 65

def self.attribute_map
  {
    :'style_content' => :'style_content',
    :'letter_format' => :'letter_format',
    :'greeting_salutation' => :'greeting_salutation',
    :'greeting_name_type' => :'greeting_name_type',
    :'greeting_secondary' => :'greeting_secondary',
    :'subscribe_link_enabled' => :'subscribe_link_enabled',
    :'subscribe_link_name' => :'subscribe_link_name',
    :'text_content' => :'text_content',
    :'permission_reminder_enabled' => :'permission_reminder_enabled',
    :'permission_reminder' => :'permission_reminder',
    :'view_as_webpage_enabled' => :'view_as_webpage_enabled',
    :'view_as_webpage_text' => :'view_as_webpage_text',
    :'view_as_webpage_link_name' => :'view_as_webpage_link_name',
    :'forward_email_link_enabled' => :'forward_email_link_enabled',
    :'forward_email_link_name' => :'forward_email_link_name'
  }
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



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 409

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



112
113
114
115
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 112

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'style_content' => :'String',
    :'letter_format' => :'String',
    :'greeting_salutation' => :'String',
    :'greeting_name_type' => :'String',
    :'greeting_secondary' => :'String',
    :'subscribe_link_enabled' => :'String',
    :'subscribe_link_name' => :'String',
    :'text_content' => :'String',
    :'permission_reminder_enabled' => :'String',
    :'permission_reminder' => :'String',
    :'view_as_webpage_enabled' => :'String',
    :'view_as_webpage_text' => :'String',
    :'view_as_webpage_link_name' => :'String',
    :'forward_email_link_enabled' => :'String',
    :'forward_email_link_name' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 374

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      style_content == o.style_content &&
      letter_format == o.letter_format &&
      greeting_salutation == o.greeting_salutation &&
      greeting_name_type == o.greeting_name_type &&
      greeting_secondary == o.greeting_secondary &&
      subscribe_link_enabled == o.subscribe_link_enabled &&
      subscribe_link_name == o.subscribe_link_name &&
      text_content == o.text_content &&
      permission_reminder_enabled == o.permission_reminder_enabled &&
      permission_reminder == o.permission_reminder &&
      view_as_webpage_enabled == o.view_as_webpage_enabled &&
      view_as_webpage_text == o.view_as_webpage_text &&
      view_as_webpage_link_name == o.view_as_webpage_link_name &&
      forward_email_link_enabled == o.forward_email_link_enabled &&
      forward_email_link_name == o.forward_email_link_name
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 504

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


396
397
398
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 396

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



402
403
404
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 402

def hash
  [style_content, letter_format, greeting_salutation, greeting_name_type, greeting_secondary, subscribe_link_enabled, subscribe_link_name, text_content, permission_reminder_enabled, permission_reminder, view_as_webpage_enabled, view_as_webpage_text, view_as_webpage_link_name, forward_email_link_enabled, forward_email_link_name].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 207

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@style_content.nil? && @style_content.to_s.length > 150000
    invalid_properties.push('invalid value for "style_content", the character length must be smaller than or equal to 150000.')
  end

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

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

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

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

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

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

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

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



480
481
482
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 480

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 486

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



474
475
476
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 474

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/constant_contact_client/models/get_email_campaign_activity200_response_document_properties.rb', line 247

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@style_content.nil? && @style_content.to_s.length > 150000
  return false if !@greeting_salutation.nil? && @greeting_salutation.to_s.length > 50
  return false if !@greeting_secondary.nil? && @greeting_secondary.to_s.length > 1500
  return false if !@subscribe_link_name.nil? && @subscribe_link_name.to_s.length > 80
  return false if !@text_content.nil? && @text_content.to_s.length > 150000
  return false if !@permission_reminder.nil? && @permission_reminder.to_s.length > 1500
  return false if !@view_as_webpage_text.nil? && @view_as_webpage_text.to_s.length > 50
  return false if !@forward_email_link_name.nil? && @forward_email_link_name.to_s.length > 80
  true
end