Class: OCI::Queue::Models::GetMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/queue/models/get_message.rb

Overview

A message consumed from a queue.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GetMessage

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :id (Integer)

    The value to assign to the #id property

  • :content (String)

    The value to assign to the #content property

  • :receipt (String)

    The value to assign to the #receipt property

  • :delivery_count (Integer)

    The value to assign to the #delivery_count property

  • :visible_after (DateTime)

    The value to assign to the #visible_after property

  • :expire_after (DateTime)

    The value to assign to the #expire_after property

  • :created_at (DateTime)

    The value to assign to the #created_at property

  • :metadata (OCI::Queue::Models::MessageMetadata)

    The value to assign to the #metadata property



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/oci/queue/models/get_message.rb', line 99

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.id = attributes[:'id'] if attributes[:'id']

  self.content = attributes[:'content'] if attributes[:'content']

  self.receipt = attributes[:'receipt'] if attributes[:'receipt']

  self.delivery_count = attributes[:'deliveryCount'] if attributes[:'deliveryCount']

  raise 'You cannot provide both :deliveryCount and :delivery_count' if attributes.key?(:'deliveryCount') && attributes.key?(:'delivery_count')

  self.delivery_count = attributes[:'delivery_count'] if attributes[:'delivery_count']

  self.visible_after = attributes[:'visibleAfter'] if attributes[:'visibleAfter']

  raise 'You cannot provide both :visibleAfter and :visible_after' if attributes.key?(:'visibleAfter') && attributes.key?(:'visible_after')

  self.visible_after = attributes[:'visible_after'] if attributes[:'visible_after']

  self.expire_after = attributes[:'expireAfter'] if attributes[:'expireAfter']

  raise 'You cannot provide both :expireAfter and :expire_after' if attributes.key?(:'expireAfter') && attributes.key?(:'expire_after')

  self.expire_after = attributes[:'expire_after'] if attributes[:'expire_after']

  self.created_at = attributes[:'createdAt'] if attributes[:'createdAt']

  raise 'You cannot provide both :createdAt and :created_at' if attributes.key?(:'createdAt') && attributes.key?(:'created_at')

  self.created_at = attributes[:'created_at'] if attributes[:'created_at']

  self. = attributes[:'metadata'] if attributes[:'metadata']
end

Instance Attribute Details

#contentString

[Required] The content of the message.

Returns:

  • (String)


17
18
19
# File 'lib/oci/queue/models/get_message.rb', line 17

def content
  @content
end

#created_atDateTime

[Required] The time when message was created in queue.

Example: 2018-04-20T00:00:07.405Z

Returns:

  • (DateTime)


48
49
50
# File 'lib/oci/queue/models/get_message.rb', line 48

def created_at
  @created_at
end

#delivery_countInteger

[Required] The number of times that the message has been delivered to a consumer.

Returns:

  • (Integer)


27
28
29
# File 'lib/oci/queue/models/get_message.rb', line 27

def delivery_count
  @delivery_count
end

#expire_afterDateTime

[Required] The time after which the message will be automatically deleted, expressed in RFC 3339 timestamp format.

Example: 2018-04-20T00:00:07.405Z

Returns:

  • (DateTime)


41
42
43
# File 'lib/oci/queue/models/get_message.rb', line 41

def expire_after
  @expire_after
end

#idInteger

[Required] The ID of the message. This ID is only used for tracing and debugging purposes and isn't used as a parameter in any request.

Returns:

  • (Integer)


13
14
15
# File 'lib/oci/queue/models/get_message.rb', line 13

def id
  @id
end

#metadataOCI::Queue::Models::MessageMetadata



51
52
53
# File 'lib/oci/queue/models/get_message.rb', line 51

def 
  @metadata
end

#receiptString

[Required] A receipt is a base64urlencode opaque token, uniquely representing a message. The receipt can be used to delete a message or update its visibility.

Returns:

  • (String)


23
24
25
# File 'lib/oci/queue/models/get_message.rb', line 23

def receipt
  @receipt
end

#visible_afterDateTime

[Required] The time after which the message will be visible to other consumers, expressed in RFC 3339 timestamp format.

Example: 2018-04-20T00:00:07.405Z

Returns:

  • (DateTime)


34
35
36
# File 'lib/oci/queue/models/get_message.rb', line 34

def visible_after
  @visible_after
end

Class Method Details

.attribute_mapObject

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



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/oci/queue/models/get_message.rb', line 54

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'content': :'content',
    'receipt': :'receipt',
    'delivery_count': :'deliveryCount',
    'visible_after': :'visibleAfter',
    'expire_after': :'expireAfter',
    'created_at': :'createdAt',
    'metadata': :'metadata'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/oci/queue/models/get_message.rb', line 70

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'Integer',
    'content': :'String',
    'receipt': :'String',
    'delivery_count': :'Integer',
    'visible_after': :'DateTime',
    'expire_after': :'DateTime',
    'created_at': :'DateTime',
    'metadata': :'OCI::Queue::Models::MessageMetadata'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/oci/queue/models/get_message.rb', line 145

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    id == other.id &&
    content == other.content &&
    receipt == other.receipt &&
    delivery_count == other.delivery_count &&
    visible_after == other.visible_after &&
    expire_after == other.expire_after &&
    created_at == other.created_at &&
     == other.
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



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/oci/queue/models/get_message.rb', line 182

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


162
163
164
# File 'lib/oci/queue/models/get_message.rb', line 162

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



171
172
173
# File 'lib/oci/queue/models/get_message.rb', line 171

def hash
  [id, content, receipt, delivery_count, visible_after, expire_after, created_at, ].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



215
216
217
218
219
220
221
222
223
224
# File 'lib/oci/queue/models/get_message.rb', line 215

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



209
210
211
# File 'lib/oci/queue/models/get_message.rb', line 209

def to_s
  to_hash.to_s
end