Class: Late::SendInboxMessageRequest

Inherits:
ApiModelBase show all
Defined in:
lib/late-sdk/models/send_inbox_message_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 113

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Social account ID



19
20
21
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 19

def 
  @account_id
end

#buttonsObject

Action buttons. Mutually exclusive with quickReplies. Max 3 items.



28
29
30
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 28

def buttons
  @buttons
end

#messageObject

Message text



22
23
24
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 22

def message
  @message
end

#message_tagObject

Facebook message tag for messaging outside 24h window. Requires messagingType MESSAGE_TAG. Instagram only supports HUMAN_AGENT.



38
39
40
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 38

def message_tag
  @message_tag
end

#messaging_typeObject

Facebook messaging type. Required when using messageTag.



35
36
37
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 35

def messaging_type
  @messaging_type
end

#quick_repliesObject

Quick reply buttons. Mutually exclusive with buttons. Max 13 items.



25
26
27
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 25

def quick_replies
  @quick_replies
end

#reply_markupObject

Returns the value of attribute reply_markup.



32
33
34
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 32

def reply_markup
  @reply_markup
end

#reply_toObject

Platform message ID to reply to (Telegram only).



41
42
43
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 41

def reply_to
  @reply_to
end

#templateObject

Returns the value of attribute template.



30
31
32
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 30

def template
  @template
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



81
82
83
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 81

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



86
87
88
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 86

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 66

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'message' => :'message',
    :'quick_replies' => :'quickReplies',
    :'buttons' => :'buttons',
    :'template' => :'template',
    :'reply_markup' => :'replyMarkup',
    :'messaging_type' => :'messagingType',
    :'message_tag' => :'messageTag',
    :'reply_to' => :'replyTo'
  }
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



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 293

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



106
107
108
109
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 106

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

.openapi_typesObject

Attribute type mapping.



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 91

def self.openapi_types
  {
    :'account_id' => :'String',
    :'message' => :'String',
    :'quick_replies' => :'Array<SendInboxMessageRequestQuickRepliesInner>',
    :'buttons' => :'Array<SendInboxMessageRequestButtonsInner>',
    :'template' => :'SendInboxMessageRequestTemplate',
    :'reply_markup' => :'SendInboxMessageRequestReplyMarkup',
    :'messaging_type' => :'String',
    :'message_tag' => :'String',
    :'reply_to' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 264

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      message == o.message &&
      quick_replies == o.quick_replies &&
      buttons == o.buttons &&
      template == o.template &&
      reply_markup == o.reply_markup &&
      messaging_type == o.messaging_type &&
      message_tag == o.message_tag &&
      reply_to == o.reply_to
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


280
281
282
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 280

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



286
287
288
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 286

def hash
  [, message, quick_replies, buttons, template, reply_markup, messaging_type, message_tag, reply_to].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 172

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @account_id.nil?
    invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
  end

  if !@quick_replies.nil? && @quick_replies.length > 13
    invalid_properties.push('invalid value for "quick_replies", number of items must be less than or equal to 13.')
  end

  if !@buttons.nil? && @buttons.length > 3
    invalid_properties.push('invalid value for "buttons", number of items must be less than or equal to 3.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 315

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



192
193
194
195
196
197
198
199
200
201
202
# File 'lib/late-sdk/models/send_inbox_message_request.rb', line 192

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  return false if !@quick_replies.nil? && @quick_replies.length > 13
  return false if !@buttons.nil? && @buttons.length > 3
  messaging_type_validator = EnumAttributeValidator.new('String', ["RESPONSE", "UPDATE", "MESSAGE_TAG"])
  return false unless messaging_type_validator.valid?(@messaging_type)
  message_tag_validator = EnumAttributeValidator.new('String', ["CONFIRMED_EVENT_UPDATE", "POST_PURCHASE_UPDATE", "ACCOUNT_UPDATE", "HUMAN_AGENT"])
  return false unless message_tag_validator.valid?(@message_tag)
  true
end