Method: RelateIq::List.from_json

Defined in:
lib/relateiq/list.rb

.from_json(json_string) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/relateiq/list.rb', line 37

def self.from_json(json_string)
  lists_hash = JSON.parse(json_string, symbolize_names: true)
  if lists_hash.key? :objects
    lists_hash[:objects].map { |li| List.new(li) }
  else
    List.new(lists_hash)
  end
end