Class: Fog::Rackspace::Queues::Message
- Inherits:
-
Model
- Object
- Model
- Fog::Rackspace::Queues::Message
- Defined in:
- lib/fog/rackspace/models/queues/message.rb
Instance Attribute Summary collapse
-
#age ⇒ Integer
readonly
The number of seconds relative to the server’s clock.
-
#body ⇒ String, ...
Specifies an arbitrary document that constitutes the body of the message being sent.
-
#claim_id ⇒ String
readonly
The id of the claim.
-
#href ⇒ String
readonly
Location of the message.
-
#identity ⇒ String
(also: #id)
readonly
The messages identity.
-
#ttl ⇒ Integer
age has reached up to (ttl + 60) seconds, to allow for flexibility in storage implementations.
Instance Method Summary collapse
-
#destroy ⇒ Boolean
Destroys Message.
-
#save ⇒ Boolean
Creates messages Requires queue, client_id, body, and ttl attributes to be populated.
Instance Attribute Details
#age ⇒ Integer (readonly)
Returns The number of seconds relative to the server’s clock.
9 |
# File 'lib/fog/rackspace/models/queues/message.rb', line 9 attribute :age |
#body ⇒ String, ...
Returns specifies an arbitrary document that constitutes the body of the message being sent. The size of this body is limited to 256 KB, excluding whitespace. The document must be valid JSON.
19 |
# File 'lib/fog/rackspace/models/queues/message.rb', line 19 attribute :body |
#claim_id ⇒ String (readonly)
Returns the id of the claim.
27 |
# File 'lib/fog/rackspace/models/queues/message.rb', line 27 attribute :claim_id |
#href ⇒ String (readonly)
Returns location of the message.
23 |
# File 'lib/fog/rackspace/models/queues/message.rb', line 23 attribute :href |
#identity ⇒ String (readonly) Also known as: id
Returns The messages identity.
31 32 33 34 35 36 |
# File 'lib/fog/rackspace/models/queues/message.rb', line 31 def identity return nil unless href match = href.match(/\A.*\/queues\/[a-zA-Z0-9_-]{0,64}\/messages\/(.+?)(?:\?|\z)/i) match ? match[1] : nil end |
#ttl ⇒ Integer
The value of ttl must be between 60 and 1209600 seconds (14 days). Note that the server might not actually delete the message until its
age has reached up to (ttl + 60) seconds, to allow for flexibility in storage implementations.
15 |
# File 'lib/fog/rackspace/models/queues/message.rb', line 15 attribute :ttl |
Instance Method Details
#destroy ⇒ Boolean
Destroys Message
67 68 69 70 71 72 73 74 |
# File 'lib/fog/rackspace/models/queues/message.rb', line 67 def destroy requires :identity, :queue = {} [:claim_id] = claim_id unless claim_id.nil? service.(queue.name, identity, ) true end |
#save ⇒ Boolean
messages cannot be updated
Creates messages Requires queue, client_id, body, and ttl attributes to be populated
50 51 52 53 54 55 56 |
# File 'lib/fog/rackspace/models/queues/message.rb', line 50 def save requires :queue, :client_id, :body, :ttl raise "Message has already been created and may not be updated." unless identity.nil? data = service.(client_id, queue.name, body, ttl).body self.href = data['resources'][0] true end |