Class: Fog::Rackspace::Queues::Message

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/rackspace/models/queues/message.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



30
31
32
33
34
35
36
37
# File 'lib/fog/rackspace/models/queues/message.rb', line 30

def destroy
  requires :identity, :queue
  options = {}
  options[:claim_id] = claim_id unless claim_id.nil?

  service.delete_message(queue.name, identity, options)
  true
end

#identityObject



14
15
16
17
18
19
20
# File 'lib/fog/rackspace/models/queues/message.rb', line 14

def identity
  if href
    href.split('/').last
  else
    nil
  end
end

#saveObject



22
23
24
25
26
27
28
# File 'lib/fog/rackspace/models/queues/message.rb', line 22

def save
  requires :queue, :client_id, :body, :ttl
  raise "Message has already been created and may not be updated." unless identity.nil?
  data = service.create_message(client_id, queue.name, body, ttl).body
  self.href = data['resources'][0]
  true
end