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



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

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.



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

def call
  @call
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#force_channelsObject

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



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

def force_channels
  @force_channels
end

#inappObject

Returns the value of attribute inapp.



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

def inapp
  @inapp
end

#merge_tagsObject

Returns the value of attribute merge_tags.



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

def merge_tags
  @merge_tags
end

#mobile_pushObject

Returns the value of attribute mobile_push.



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

def mobile_push
  @mobile_push
end

#notification_idObject

Returns the value of attribute notification_id.



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

def notification_id
  @notification_id
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

#parametersObject

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



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

def parameters
  @parameters
end

#replaceObject

Returns the value of attribute replace.



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

def replace
  @replace
end

#scheduleObject

Returns the value of attribute schedule.



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

def schedule
  @schedule
end

#secondary_idObject

Optional sub-notification identifier for grouping or tracking.



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

def secondary_id
  @secondary_id
end

#slackObject

Returns the value of attribute slack.



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

def slack
  @slack
end

#smsObject

Returns the value of attribute sms.



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

def sms
  @sms
end

#sub_notification_idObject

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



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

def sub_notification_id
  @sub_notification_id
end

#template_idObject

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



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

def template_id
  @template_id
end

#toObject

Returns the value of attribute to.



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

def to
  @to
end

#typeObject

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



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

def type
  @type
end

#userObject

Returns the value of attribute user.



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

def user
  @user
end

#web_pushObject

Returns the value of attribute web_push.



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

def web_push
  @web_push
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



91
92
93
# File 'lib/pingram/models/sender_post_body.rb', line 91

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



96
97
98
# File 'lib/pingram/models/sender_post_body.rb', line 96

def self.acceptable_attributes
  acceptable_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
84
85
86
87
88
# File 'lib/pingram/models/sender_post_body.rb', line 65

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



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

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



127
128
129
130
# File 'lib/pingram/models/sender_post_body.rb', line 127

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

.openapi_typesObject

Attribute type mapping.



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

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



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

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


279
280
281
# File 'lib/pingram/models/sender_post_body.rb', line 279

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



285
286
287
# File 'lib/pingram/models/sender_post_body.rb', line 285

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



237
238
239
240
241
# File 'lib/pingram/models/sender_post_body.rb', line 237

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



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

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



245
246
247
248
# File 'lib/pingram/models/sender_post_body.rb', line 245

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