Class: GetStatusResponse
- Defined in:
- lib/dto/status/get_status_response.rb
Overview
Class GetStatusResponse represents server response on get_status
Status API request. Server response is sent to from_array
method which creates objects attributes exists
, externalID
, source
, history
accessible via getters:
-
exists
-
externalID
-
source
-
history
Example:
response = GetStatusResponse.from_array(...) # => Array
Defined Under Namespace
Instance Attribute Summary collapse
-
#exists ⇒ Object
Returns the value of attribute exists.
-
#externalID ⇒ Object
Returns the value of attribute externalID.
-
#history ⇒ Object
Returns the value of attribute history.
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
-
.from_array(json) ⇒ Object
Method
from_array
creates GetStatusResponse object.
Methods inherited from Struct
Instance Attribute Details
#exists ⇒ Object
Returns the value of attribute exists
13 14 15 |
# File 'lib/dto/status/get_status_response.rb', line 13 def exists @exists end |
#externalID ⇒ Object
Returns the value of attribute externalID
13 14 15 |
# File 'lib/dto/status/get_status_response.rb', line 13 def externalID @externalID end |
#history ⇒ Object
Returns the value of attribute history
13 14 15 |
# File 'lib/dto/status/get_status_response.rb', line 13 def history @history end |
#source ⇒ Object
Returns the value of attribute source
13 14 15 |
# File 'lib/dto/status/get_status_response.rb', line 13 def source @source end |
Class Method Details
.from_array(json) ⇒ Object
Method from_array
creates GetStatusResponse object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dto/status/get_status_response.rb', line 33 def self.from_array(json) json.each do |hash| hash.each do |key, value| self.new("#{key}=".to_sym, key == 'history' ? value.collect { |key, items| Status.new(:field => key, :attrs => items.collect {|item| Attr.new(:timestamp => item["timestamp"], :errors => item["errors"], :attributes => item["attributes"]) } )} : value ) end end end |