Class: Gliffy::ArrayParser

Inherits:
Object
  • Object
show all
Defined in:
lib/gliffy/response.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.from_http_response(root, single_class, plural_name, single_name) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/gliffy/response.rb', line 126

def self.from_http_response(root,single_class,plural_name,single_name)
  root = root[plural_name]
  return nil if root.nil?
  if root[single_name].kind_of?(Array)
    list = Array.new
    root[single_name].each do |item|
      list << single_class.from_http_response(item)
    end
    list
  else
    [single_class.from_http_response(root[single_name])]
  end
end