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



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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/pingram/models/sender_post_body.rb', line 131

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?(:'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.



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

def call
  @call
end

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#force_channelsObject

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



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

def force_channels
  @force_channels
end

#inappObject

Returns the value of attribute inapp.



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

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.



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

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.



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

def options
  @options
end

#parametersObject

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



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

def parameters
  @parameters
end

#scheduleObject

Returns the value of attribute schedule.



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

def schedule
  @schedule
end

#secondary_idObject

Optional sub-notification identifier for grouping or tracking.



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

def secondary_id
  @secondary_id
end

#slackObject

Returns the value of attribute slack.



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

def slack
  @slack
end

#smsObject

Returns the value of attribute sms.



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

def sms
  @sms
end

#sub_notification_idObject

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



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

def sub_notification_id
  @sub_notification_id
end

#template_idObject

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



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

def template_id
  @template_id
end

#toObject

Returns the value of attribute to.



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

def to
  @to
end

#typeObject

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



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

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.



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

def web_push
  @web_push
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



89
90
91
# File 'lib/pingram/models/sender_post_body.rb', line 89

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'notification_id' => :'notificationId',
    :'user' => :'user',
    :'merge_tags' => :'mergeTags',
    :'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



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/pingram/models/sender_post_body.rb', line 282

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



124
125
126
127
# File 'lib/pingram/models/sender_post_body.rb', line 124

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'notification_id' => :'String',
    :'user' => :'SenderPostBodyUser',
    :'merge_tags' => :'Object',
    :'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



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/pingram/models/sender_post_body.rb', line 243

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 &&
      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


269
270
271
# File 'lib/pingram/models/sender_post_body.rb', line 269

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



275
276
277
# File 'lib/pingram/models/sender_post_body.rb', line 275

def hash
  [notification_id, user, merge_tags, 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



228
229
230
231
232
# File 'lib/pingram/models/sender_post_body.rb', line 228

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



304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/pingram/models/sender_post_body.rb', line 304

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



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

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