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



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

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



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

def call
  @call
end

#emailObject

Returns the value of attribute email.



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

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.



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

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.



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

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.



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

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.



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

def schedule
  @schedule
end

#slackObject

Returns the value of attribute slack.



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

def slack
  @slack
end

#smsObject

Returns the value of attribute sms.



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

def sms
  @sms
end

#sub_notification_idObject

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



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

def sub_notification_id
  @sub_notification_id
end

#template_idObject

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



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

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.



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

def web_push
  @web_push
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



85
86
87
# File 'lib/pingram/models/sender_post_body.rb', line 85

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

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



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/pingram/models/sender_post_body.rb', line 272

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



119
120
121
122
# File 'lib/pingram/models/sender_post_body.rb', line 119

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

.openapi_typesObject

Attribute type mapping.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/pingram/models/sender_post_body.rb', line 95

def self.openapi_types
  {
    :'notification_id' => :'String',
    :'user' => :'SenderPostBodyUser',
    :'merge_tags' => :'Object',
    :'type' => :'String',
    :'to' => :'SenderPostBodyTo',
    :'force_channels' => :'Array<ChannelsEnum>',
    :'parameters' => :'Hash<String, Object>',
    :'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



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/pingram/models/sender_post_body.rb', line 234

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


259
260
261
# File 'lib/pingram/models/sender_post_body.rb', line 259

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



265
266
267
# File 'lib/pingram/models/sender_post_body.rb', line 265

def hash
  [notification_id, user, merge_tags, type, to, force_channels, parameters, 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



219
220
221
222
223
# File 'lib/pingram/models/sender_post_body.rb', line 219

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



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

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



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

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