Method: Aimastering::ExternalSearchResult#initialize

Defined in:
lib/aimastering/models/external_search_result.rb

#initialize(attributes = {}) ⇒ ExternalSearchResult

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/aimastering/models/external_search_result.rb', line 41

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'itunes')
    if (value = attributes[:'itunes']).is_a?(Array)
      self.itunes = value
    end
  end

  if attributes.has_key?(:'youtube')
    if (value = attributes[:'youtube']).is_a?(Array)
      self.youtube = value
    end
  end

end