Class: SoapyCake::Response
- Inherits:
-
Object
- Object
- SoapyCake::Response
- Includes:
- Helper
- Defined in:
- lib/soapy_cake/response.rb
Constant Summary collapse
- SHORT_ELEMENT_DEPTH =
3
- ELEMENTS_DEPTH =
5
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#short_response ⇒ Object
readonly
Returns the value of attribute short_response.
-
#time_converter ⇒ Object
readonly
Returns the value of attribute time_converter.
Instance Method Summary collapse
-
#initialize(body, short_response, time_converter) ⇒ Response
constructor
A new instance of Response.
- #to_enum ⇒ Object
- #to_xml ⇒ Object
Methods included from Helper
#const_lookup, #future_expiration_date, #require_params, #translate_booleans, #translate_values, #validate_id, #walk_tree
Constructor Details
#initialize(body, short_response, time_converter) ⇒ Response
Returns a new instance of Response.
12 13 14 15 16 |
# File 'lib/soapy_cake/response.rb', line 12 def initialize(body, short_response, time_converter) @body = body @short_response = short_response @time_converter = time_converter end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/soapy_cake/response.rb', line 10 def body @body end |
#short_response ⇒ Object (readonly)
Returns the value of attribute short_response.
10 11 12 |
# File 'lib/soapy_cake/response.rb', line 10 def short_response @short_response end |
#time_converter ⇒ Object (readonly)
Returns the value of attribute time_converter.
10 11 12 |
# File 'lib/soapy_cake/response.rb', line 10 def time_converter @time_converter end |
Instance Method Details
#to_enum ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/soapy_cake/response.rb', line 18 def to_enum check_errors! return typed_element(sax.at_depth(SHORT_ELEMENT_DEPTH).first) if short_response Enumerator.new do |y| sax.at_depth(ELEMENTS_DEPTH).each do |element| y << typed_element(element) end end end |
#to_xml ⇒ Object
30 31 32 33 34 |
# File 'lib/soapy_cake/response.rb', line 30 def to_xml check_errors! (empty? ? [] : [body.to_s]).to_enum end |