Method: AwarenessApi::Response#to_s

Defined in:
lib/awareness_api/response.rb

#to_sObject



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 @message
  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