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

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

    The value to assign to the #metadata property



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/oci/queue/models/get_message.rb', line 89

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. = 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

#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



44
45
46
# File 'lib/oci/queue/models/get_message.rb', line 44

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.



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/oci/queue/models/get_message.rb', line 47

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

.swagger_typesObject

Attribute type mapping.



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/oci/queue/models/get_message.rb', line 62

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'Integer',
    'content': :'String',
    'receipt': :'String',
    'delivery_count': :'Integer',
    'visible_after': :'DateTime',
    'expire_after': :'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



129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/oci/queue/models/get_message.rb', line 129

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



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/oci/queue/models/get_message.rb', line 165

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


145
146
147
# File 'lib/oci/queue/models/get_message.rb', line 145

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



154
155
156
# File 'lib/oci/queue/models/get_message.rb', line 154

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

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



198
199
200
201
202
203
204
205
206
207
# File 'lib/oci/queue/models/get_message.rb', line 198

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



192
193
194
# File 'lib/oci/queue/models/get_message.rb', line 192

def to_s
  to_hash.to_s
end