Class: RightScale::CloudApi::ResultWrapper

Inherits:
Routine show all
Defined in:
lib/base/routines/result_wrapper.rb

Overview

The Routine adds metadata to the result.

@example:

response = ec2.DescribeSecurityGroups #=> A list of SecurityGroups
response.metadata #=>
  {:headers=>
    {"content-type"=>["text/xml;charset=UTF-8"],
     "transfer-encoding"=>["chunked"],
     "date"=>["Fri, 22 Feb 2013 00:02:43 GMT"],
     "server"=>["AmazonEC2"]},
   :code=>"200",
   :cache=>
    {:key=>"DescribeSecurityGroups",
     :record=>
      {:timestamp=>2013-02-22 00:02:44 UTC,
       :md5=>"0e3e12e1c18237d9f9510e90e7b8950e",
       :hits=>0}}}

Defined Under Namespace

Classes: Result

Instance Attribute Summary

Attributes inherited from Routine

#data

Instance Method Summary collapse

Methods inherited from Routine

#cloud_api_logger, #execute, #invoke_callback_method, #options, #reset, #with_timer

Instance Method Details

#processObject

Main entry point.



63
64
65
66
67
68
69
70
71
# File 'lib/base/routines/result_wrapper.rb', line 63

def process
  cache = data._at(:vars, :cache, :default => nil)
   = {}
  [:headers] = data[:response][:instance].headers
  [:code]    = data[:response][:instance].code
  [:cache]   = cache if cache
  #
  data[:result] = Result::new(data[:result], )
end