Class: Pingram::CreateBroadcastRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Pingram::CreateBroadcastRequest
- Defined in:
- lib/pingram/models/create_broadcast_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#audience ⇒ Object
Returns the value of attribute audience.
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#from_address ⇒ Object
Returns the value of attribute from_address.
-
#from_name ⇒ Object
Returns the value of attribute from_name.
-
#html ⇒ Object
Returns the value of attribute html.
-
#internal_template ⇒ Object
Optional visual-editor source.
-
#name ⇒ Object
Returns the value of attribute name.
-
#reply_to_address ⇒ Object
Returns the value of attribute reply_to_address.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#type ⇒ Object
Notification type id.
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 = {}) ⇒ CreateBroadcastRequest
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 = {}) ⇒ CreateBroadcastRequest
Initializes the object
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 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/pingram/models/create_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::CreateBroadcastRequest` 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::CreateBroadcastRequest`. 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'] else self.name = nil 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'] else self.audience = nil end if attributes.key?(:'from_name') self.from_name = attributes[:'from_name'] else self.from_name = nil end if attributes.key?(:'from_address') self.from_address = attributes[:'from_address'] else self.from_address = nil end if attributes.key?(:'reply_to_address') self.reply_to_address = attributes[:'reply_to_address'] end if attributes.key?(:'subject') self.subject = attributes[:'subject'] else self.subject = nil end if attributes.key?(:'html') self.html = attributes[:'html'] else self.html = nil 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.
25 26 27 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 25 def audience @audience end |
#channel ⇒ Object
Returns the value of attribute channel.
23 24 25 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 23 def channel @channel end |
#from_address ⇒ Object
Returns the value of attribute from_address.
29 30 31 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 29 def from_address @from_address end |
#from_name ⇒ Object
Returns the value of attribute from_name.
27 28 29 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 27 def from_name @from_name end |
#html ⇒ Object
Returns the value of attribute html.
35 36 37 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 35 def html @html end |
#internal_template ⇒ Object
Optional visual-editor source. Can only be set at create time and must stay paired with html.
38 39 40 |
# File 'lib/pingram/models/create_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/create_broadcast_request.rb', line 18 def name @name end |
#reply_to_address ⇒ Object
Returns the value of attribute reply_to_address.
31 32 33 |
# File 'lib/pingram/models/create_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/create_broadcast_request.rb', line 33 def subject @subject end |
#type ⇒ Object
Notification type id. Optional on create; required before send/schedule. Created on the fly when missing.
21 22 23 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 21 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/create_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/create_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/create_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
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 328 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/create_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/create_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.
298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 298 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
315 316 317 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 315 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
321 322 323 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 321 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?
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 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 181 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @audience.nil? invalid_properties.push('invalid value for "audience", audience cannot be nil.') end if @from_name.nil? invalid_properties.push('invalid value for "from_name", from_name cannot be nil.') end if @from_address.nil? invalid_properties.push('invalid value for "from_address", from_address cannot be nil.') end if @subject.nil? invalid_properties.push('invalid value for "subject", subject cannot be nil.') end if @html.nil? invalid_properties.push('invalid value for "html", html cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 350 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
213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/pingram/models/create_broadcast_request.rb', line 213 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? channel_validator = EnumAttributeValidator.new('String', ["email"]) return false unless channel_validator.valid?(@channel) return false if @audience.nil? return false if @from_name.nil? return false if @from_address.nil? return false if @subject.nil? return false if @html.nil? true end |