build

in lib/facebook_ads/ad_objects/server_side/user_data.rb [378:494]


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

        
        attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

        if attributes.has_key?(:'emails')
          self.emails = attributes[:'emails']
        elsif attributes.has_key?(:'email')
          self.emails = [attributes[:'email']]
        end

        if attributes.has_key?(:'phones')
          self.phones = attributes[:'phones']
        elsif attributes.has_key?(:'phone')
          self.phones = [attributes[:'phone']]
        end

        if attributes.has_key?(:'genders')
          self.genders = attributes[:'genders']
        elsif attributes.has_key?(:'gender')
          self.genders = [attributes[:'gender']]
        end

        if attributes.has_key?(:'dates_of_birth')
          self.dates_of_birth = attributes[:'dates_of_birth']
        elsif attributes.has_key?(:'date_of_birth')
          self.dates_of_birth = [attributes[:'date_of_birth']]
        end

        if attributes.has_key?(:'last_names')
          self.last_names = attributes[:'last_names']
        elsif attributes.has_key?(:'last_name')
          self.last_names = [attributes[:'last_name']]
        end

        if attributes.has_key?(:'first_names')
          self.first_names = attributes[:'first_names']
        elsif attributes.has_key?(:'first_name')
          self.first_names = [attributes[:'first_name']]
        end

        if attributes.has_key?(:'cities')
          self.cities = attributes[:'cities']
        elsif attributes.has_key?(:'city')
          self.cities = [attributes[:'city']]
        end

        if attributes.has_key?(:'country_codes')
          self.country_codes = attributes[:'country_codes']
        elsif attributes.has_key?(:'country_code')
          self.country_codes = [attributes[:'country_code']]
        end

        if attributes.has_key?(:'states')
          self.states = attributes[:'states']
        elsif attributes.has_key?(:'state')
          self.states = [attributes[:'state']]
        end

        if attributes.has_key?(:'zip_codes')
          self.zip_codes = attributes[:'zip_codes']
        elsif attributes.has_key?(:'zip_code')
          self.zip_codes = [attributes[:'zip_code']]
        end

        if attributes.has_key?(:'external_ids')
          self.external_ids = attributes[:'external_ids']
        elsif attributes.has_key?(:'external_id')
          self.external_ids = [attributes[:'external_id']]
        end

        if attributes.has_key?(:'client_ip_address')
          self.client_ip_address = attributes[:'client_ip_address']
        end

        if attributes.has_key?(:'client_user_agent')
          self.client_user_agent = attributes[:'client_user_agent']
        end

        if attributes.has_key?(:'fbc')
          self.fbc = attributes[:'fbc']
        end

        if attributes.has_key?(:'fbp')
          self.fbp = attributes[:'fbp']
        end

        if attributes.has_key?(:'lead_id')
          self.lead_id = attributes[:'lead_id']
        end

        if attributes.has_key?(:'f5first')
          self.f5first = attributes[:'f5first']
        end

        if attributes.has_key?(:'f5last')
          self.f5last = attributes[:'f5last']
        end

        if attributes.has_key?(:'fi')
          self.fi = attributes[:'fi']
        end

        if attributes.has_key?(:'dobd')
          self.dobd = attributes[:'dobd']
        end

        if attributes.has_key?(:'dobm')
          self.dobm = attributes[:'dobm']
        end

        if attributes.has_key?(:'doby')
          self.doby = attributes[:'doby']
        end
      end