Class: AwarenessApi::Response
- Inherits:
-
Object
- Object
- AwarenessApi::Response
- Defined in:
- lib/awareness_api/response.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#feeds ⇒ Object
Returns the value of attribute feeds.
-
#message ⇒ Object
Returns the value of attribute message.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/awareness_api/response.rb', line 6 def initialize @feeds = [] end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/awareness_api/response.rb', line 4 def code @code end |
#feeds ⇒ Object
Returns the value of attribute feeds.
4 5 6 |
# File 'lib/awareness_api/response.rb', line 4 def feeds @feeds end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/awareness_api/response.rb', line 4 def end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/awareness_api/response.rb', line 4 def status @status end |
Instance Method Details
#to_s ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/awareness_api/response.rb', line 10 def to_s output = [] output << "Status: #{@status}" output << "Code: #{@code}" if @code output << "Message: #{@message}" if for feed in @feeds output << "-Feed" feed.attributes.each do |key,val| output << " #{key}: #{val}" end for entry in feed.entries output << " -Entry" entry.attributes.each do |key,val| output << " #{key}: #{val}" end for item in entry.items output << " -Item" item.attributes.each do |key,val| output << " #{key}: #{val}" end for referer in item.referers output << " -Referer" referer.attributes.each do |key,val| output << " #{key}: #{val}" end end end end end return output.join("\n") end |