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_offset ⇒ Object
readonly
Returns the value of attribute time_offset.
Instance Method Summary collapse
-
#initialize(body, short_response, time_offset) ⇒ 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_offset) ⇒ Response
Returns a new instance of Response.
10 11 12 13 14 |
# File 'lib/soapy_cake/response.rb', line 10 def initialize(body, short_response, time_offset) @body = body @short_response = short_response @time_offset = time_offset end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/soapy_cake/response.rb', line 8 def body @body end |
#short_response ⇒ Object (readonly)
Returns the value of attribute short_response.
8 9 10 |
# File 'lib/soapy_cake/response.rb', line 8 def short_response @short_response end |
#time_offset ⇒ Object (readonly)
Returns the value of attribute time_offset.
8 9 10 |
# File 'lib/soapy_cake/response.rb', line 8 def time_offset @time_offset end |
Instance Method Details
#to_enum ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/soapy_cake/response.rb', line 16 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
28 29 30 |
# File 'lib/soapy_cake/response.rb', line 28 def to_xml (empty? ? [] : [body.to_s]).to_enum end |