Class: Pingram::SenderPostBody

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

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/pingram/models/sender_post_body.rb', line 136

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

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

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

  if attributes.key?(:'replace')
    if (value = attributes[:'replace']).is_a?(Hash)
      self.replace = value
    end
  end

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

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

  if attributes.key?(:'force_channels')
    if (value = attributes[:'force_channels']).is_a?(Array)
      self.force_channels = value
    end
  end

  if attributes.key?(:'parameters')
    if (value = attributes[:'parameters']).is_a?(Hash)
      self.parameters = value
    end
  end

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#callObject

Returns the value of attribute call.



58
59
60
# File 'lib/pingram/models/sender_post_body.rb', line 58

def call
  @call
end

#emailObject

Returns the value of attribute email.



52
53
54
# File 'lib/pingram/models/sender_post_body.rb', line 52

def email
  @email
end

#force_channelsObject

Override which channels to send to (e.g. ["EMAIL", "SMS"]). Bypasses notification channel config.



34
35
36
# File 'lib/pingram/models/sender_post_body.rb', line 34

def force_channels
  @force_channels
end

#inappObject

Returns the value of attribute inapp.



54
55
56
# File 'lib/pingram/models/sender_post_body.rb', line 54

def inapp
  @inapp
end

#merge_tagsObject

Returns the value of attribute merge_tags.



23
24
25
# File 'lib/pingram/models/sender_post_body.rb', line 23

def merge_tags
  @merge_tags
end

#mobile_pushObject

Returns the value of attribute mobile_push.



62
63
64
# File 'lib/pingram/models/sender_post_body.rb', line 62

def mobile_push
  @mobile_push
end

#notification_idObject

Deprecated.

Use type instead



19
20
21
# File 'lib/pingram/models/sender_post_body.rb', line 19

def notification_id
  @notification_id
end

#optionsObject

Returns the value of attribute options.



48
49
50
# File 'lib/pingram/models/sender_post_body.rb', line 48

def options
  @options
end

#parametersObject

Key-value pairs for template merge tags. Replaces placeholders like {firstName} in templates.



37
38
39
# File 'lib/pingram/models/sender_post_body.rb', line 37

def parameters
  @parameters
end

#replaceObject

Deprecated.

Use parameters instead



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

def replace
  @replace
end

#scheduleObject

Returns the value of attribute schedule.



50
51
52
# File 'lib/pingram/models/sender_post_body.rb', line 50

def schedule
  @schedule
end

#secondary_idObject

Optional sub-notification identifier for grouping or tracking.



40
41
42
# File 'lib/pingram/models/sender_post_body.rb', line 40

def secondary_id
  @secondary_id
end

#slackObject

Returns the value of attribute slack.



64
65
66
# File 'lib/pingram/models/sender_post_body.rb', line 64

def slack
  @slack
end

#smsObject

Returns the value of attribute sms.



56
57
58
# File 'lib/pingram/models/sender_post_body.rb', line 56

def sms
  @sms
end

#sub_notification_idObject

Sub-notification identifier (e.g. for grouping related notifications).



46
47
48
# File 'lib/pingram/models/sender_post_body.rb', line 46

def sub_notification_id
  @sub_notification_id
end

#template_idObject

Specific template ID to use. If omitted, uses the default template for each channel.



43
44
45
# File 'lib/pingram/models/sender_post_body.rb', line 43

def template_id
  @template_id
end

#toObject

Returns the value of attribute to.



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

def to
  @to
end

#typeObject

ID of the notification type (e.g. "welcome_email"). Creates a new notification if it does not exist.



29
30
31
# File 'lib/pingram/models/sender_post_body.rb', line 29

def type
  @type
end

#userObject

Returns the value of attribute user.



21
22
23
# File 'lib/pingram/models/sender_post_body.rb', line 21

def user
  @user
end

#web_pushObject

Returns the value of attribute web_push.



60
61
62
# File 'lib/pingram/models/sender_post_body.rb', line 60

def web_push
  @web_push
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



93
94
95
# File 'lib/pingram/models/sender_post_body.rb', line 93

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



98
99
100
# File 'lib/pingram/models/sender_post_body.rb', line 98

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/pingram/models/sender_post_body.rb', line 67

def self.attribute_map
  {
    :'notification_id' => :'notificationId',
    :'user' => :'user',
    :'merge_tags' => :'mergeTags',
    :'replace' => :'replace',
    :'type' => :'type',
    :'to' => :'to',
    :'force_channels' => :'forceChannels',
    :'parameters' => :'parameters',
    :'secondary_id' => :'secondaryId',
    :'template_id' => :'templateId',
    :'sub_notification_id' => :'subNotificationId',
    :'options' => :'options',
    :'schedule' => :'schedule',
    :'email' => :'email',
    :'inapp' => :'inapp',
    :'sms' => :'sms',
    :'call' => :'call',
    :'web_push' => :'web_push',
    :'mobile_push' => :'mobile_push',
    :'slack' => :'slack'
  }
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



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/pingram/models/sender_post_body.rb', line 294

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



129
130
131
132
# File 'lib/pingram/models/sender_post_body.rb', line 129

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

.openapi_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/pingram/models/sender_post_body.rb', line 103

def self.openapi_types
  {
    :'notification_id' => :'String',
    :'user' => :'SenderPostBodyUser',
    :'merge_tags' => :'Object',
    :'replace' => :'Hash<String, String>',
    :'type' => :'String',
    :'to' => :'SenderPostBodyTo',
    :'force_channels' => :'Array<ChannelsEnum>',
    :'parameters' => :'Hash<String, Object>',
    :'secondary_id' => :'String',
    :'template_id' => :'String',
    :'sub_notification_id' => :'String',
    :'options' => :'SenderPostBodyOptions',
    :'schedule' => :'String',
    :'email' => :'SenderPostBodyEmail',
    :'inapp' => :'SenderPostBodyInapp',
    :'sms' => :'SenderPostBodySms',
    :'call' => :'SenderPostBodyCall',
    :'web_push' => :'SenderPostBodyWebPush',
    :'mobile_push' => :'SenderPostBodyMobilePush',
    :'slack' => :'SenderPostBodySlack'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/pingram/models/sender_post_body.rb', line 254

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      notification_id == o.notification_id &&
      user == o.user &&
      merge_tags == o.merge_tags &&
      replace == o.replace &&
      type == o.type &&
      to == o.to &&
      force_channels == o.force_channels &&
      parameters == o.parameters &&
      secondary_id == o.secondary_id &&
      template_id == o.template_id &&
      sub_notification_id == o.sub_notification_id &&
      options == o.options &&
      schedule == o.schedule &&
      email == o.email &&
      inapp == o.inapp &&
      sms == o.sms &&
      call == o.call &&
      web_push == o.web_push &&
      mobile_push == o.mobile_push &&
      slack == o.slack
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


281
282
283
# File 'lib/pingram/models/sender_post_body.rb', line 281

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



287
288
289
# File 'lib/pingram/models/sender_post_body.rb', line 287

def hash
  [notification_id, user, merge_tags, replace, type, to, force_channels, parameters, secondary_id, template_id, sub_notification_id, options, schedule, email, inapp, sms, call, web_push, mobile_push, slack].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



239
240
241
242
243
# File 'lib/pingram/models/sender_post_body.rb', line 239

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

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/pingram/models/sender_post_body.rb', line 316

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



247
248
249
250
# File 'lib/pingram/models/sender_post_body.rb', line 247

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end