Class: Pingram::UpdateBroadcastRequest

Inherits:
ApiModelBase show all
Defined in:
lib/pingram/models/update_broadcast_request.rb

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 = {}) ⇒ UpdateBroadcastRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



112
113
114
115
116
117
118
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
# File 'lib/pingram/models/update_broadcast_request.rb', line 112

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::UpdateBroadcastRequest` 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 `Pingram::UpdateBroadcastRequest`. 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?(:'name')
    self.name = attributes[:'name']
  end

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#audience ⇒ Object

Returns the value of attribute audience.



24
25
26
# File 'lib/pingram/models/update_broadcast_request.rb', line 24

def audience
  @audience
end

#channel ⇒ Object

Returns the value of attribute channel.



22
23
24
# File 'lib/pingram/models/update_broadcast_request.rb', line 22

def channel
  @channel
end

#from_address ⇒ Object

Returns the value of attribute from_address.



28
29
30
# File 'lib/pingram/models/update_broadcast_request.rb', line 28

def from_address
  @from_address
end

#from_name ⇒ Object

Returns the value of attribute from_name.



26
27
28
# File 'lib/pingram/models/update_broadcast_request.rb', line 26

def from_name
  @from_name
end

#html ⇒ Object

Returns the value of attribute html.



35
36
37
# File 'lib/pingram/models/update_broadcast_request.rb', line 35

def html
  @html
end

#internal_template ⇒ Object

Optional visual-editor source. Can be updated only when the broadcast was created with it; cannot be added to an html-only broadcast. Pair with html.



38
39
40
# File 'lib/pingram/models/update_broadcast_request.rb', line 38

def internal_template
  @internal_template
end

#name ⇒ Object

Returns the value of attribute name.



18
19
20
# File 'lib/pingram/models/update_broadcast_request.rb', line 18

def name
  @name
end

#reply_to_address ⇒ Object

Omit to leave unchanged. Empty string clears Reply-To.



31
32
33
# File 'lib/pingram/models/update_broadcast_request.rb', line 31

def reply_to_address
  @reply_to_address
end

#subject ⇒ Object

Returns the value of attribute subject.



33
34
35
# File 'lib/pingram/models/update_broadcast_request.rb', line 33

def subject
  @subject
end

#type ⇒ Object

Returns the value of attribute type.



20
21
22
# File 'lib/pingram/models/update_broadcast_request.rb', line 20

def type
  @type
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



79
80
81
# File 'lib/pingram/models/update_broadcast_request.rb', line 79

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



84
85
86
# File 'lib/pingram/models/update_broadcast_request.rb', line 84

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/pingram/models/update_broadcast_request.rb', line 63

def self.attribute_map
  {
    :'name' => :'name',
    :'type' => :'type',
    :'channel' => :'channel',
    :'audience' => :'audience',
    :'from_name' => :'fromName',
    :'from_address' => :'fromAddress',
    :'reply_to_address' => :'replyToAddress',
    :'subject' => :'subject',
    :'html' => :'html',
    :'internal_template' => :'internalTemplate'
  }
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



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/pingram/models/update_broadcast_request.rb', line 226

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



105
106
107
108
# File 'lib/pingram/models/update_broadcast_request.rb', line 105

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

.openapi_types ⇒ Object

Attribute type mapping.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/pingram/models/update_broadcast_request.rb', line 89

def self.openapi_types
  {
    :'name' => :'String',
    :'type' => :'String',
    :'channel' => :'String',
    :'audience' => :'BroadcastResponseAudience',
    :'from_name' => :'String',
    :'from_address' => :'String',
    :'reply_to_address' => :'String',
    :'subject' => :'String',
    :'html' => :'String',
    :'internal_template' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/pingram/models/update_broadcast_request.rb', line 196

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      name == o.name &&
      type == o.type &&
      channel == o.channel &&
      audience == o.audience &&
      from_name == o.from_name &&
      from_address == o.from_address &&
      reply_to_address == o.reply_to_address &&
      subject == o.subject &&
      html == o.html &&
      internal_template == o.internal_template
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


213
214
215
# File 'lib/pingram/models/update_broadcast_request.rb', line 213

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



219
220
221
# File 'lib/pingram/models/update_broadcast_request.rb', line 219

def hash
  [name, type, channel, audience, from_name, from_address, reply_to_address, subject, html, internal_template].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



169
170
171
172
173
# File 'lib/pingram/models/update_broadcast_request.rb', line 169

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/pingram/models/update_broadcast_request.rb', line 248

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



177
178
179
180
181
182
# File 'lib/pingram/models/update_broadcast_request.rb', line 177

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  channel_validator = EnumAttributeValidator.new('String', ["email"])
  return false unless channel_validator.valid?(@channel)
  true
end