Class: RestReply
- Inherits:
-
OpenShift::Model
- Object
- OpenShift::Model
- RestReply
- Defined in:
- app/models/rest_reply.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#status ⇒ Object
Returns the value of attribute status.
-
#supported_api_versions ⇒ Object
Returns the value of attribute supported_api_versions.
-
#type ⇒ Object
Returns the value of attribute type.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(status = nil, type = nil, data = nil) ⇒ RestReply
constructor
A new instance of RestReply.
- #process_result_io(result_io) ⇒ Object
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(status = nil, type = nil, data = nil) ⇒ RestReply
Returns a new instance of RestReply.
5 6 7 8 9 10 11 12 |
# File 'app/models/rest_reply.rb', line 5 def initialize(status=nil, type=nil, data=nil) self.status = status self.type = type self.data = data self. = [] self.version = $requested_api_version.to_s self.supported_api_versions = BaseController::SUPPORTED_API_VERSIONS end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
2 3 4 |
# File 'app/models/rest_reply.rb', line 2 def data @data end |
#messages ⇒ Object
Returns the value of attribute messages.
2 3 4 |
# File 'app/models/rest_reply.rb', line 2 def @messages end |
#status ⇒ Object
Returns the value of attribute status.
2 3 4 |
# File 'app/models/rest_reply.rb', line 2 def status @status end |
#supported_api_versions ⇒ Object
Returns the value of attribute supported_api_versions.
2 3 4 |
# File 'app/models/rest_reply.rb', line 2 def supported_api_versions @supported_api_versions end |
#type ⇒ Object
Returns the value of attribute type.
2 3 4 |
# File 'app/models/rest_reply.rb', line 2 def type @type end |
#version ⇒ Object
Returns the value of attribute version.
2 3 4 |
# File 'app/models/rest_reply.rb', line 2 def version @version end |
Instance Method Details
#process_result_io(result_io) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/models/rest_reply.rb', line 14 def process_result_io(result_io) unless result_io.nil? .push(Message.new(:debug, result_io.debugIO.string)) unless result_io.debugIO.string.empty? .push(Message.new(:info, result_io..string)) unless result_io..string.empty? .push(Message.new(:error, result_io.errorIO.string)) unless result_io.errorIO.string.empty? .push(Message.new(:result, result_io.resultIO.string)) unless result_io.resultIO.string.empty? end end |
#to_xml(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/models/rest_reply.rb', line 23 def to_xml(={}) [:tag_name] = "response" if not self.data.kind_of?Enumerable new_data = self.data self.data = [new_data] end super() end |