all files / firebase/modules/admob/ AdRequest.js

100% Statements 18/18
75% Branches 3/4
81.82% Functions 9/11
100% Lines 18/18
1 2 3 4 5 6 7 8 9 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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                                                                                 
export default class AdRequest {
  constructor() {
    this._props = {
      keywords: [],
      testDevices: [],
    };
  }
 
  build() {
    return this._props;
  }
 
  addTestDevice(deviceId?: string) {
    this._props.testDevices.push(deviceId || 'DEVICE_ID_EMULATOR');
    return this;
  }
 
  addKeyword(keyword: string) {
    this._props.keywords.push(keyword);
    return this;
  }
 
  setBirthday() {
    // TODO
  }
 
  setContentUrl(url: string) {
    this._props.contentUrl = url;
    return this;
  }
 
  setGender(gender: 'male | female | unknown') {
    const genders = ['male', 'female', 'unknown'];
    Eif (genders.includes(gender)) {
      this._props.gender = gender;
    }
    return this;
  }
 
  setLocation() {
    // TODO
  }
 
  setRequestAgent(requestAgent: string) {
    this._props.requestAgent = requestAgent;
    return this;
  }
 
  setIsDesignedForFamilies(isDesignedForFamilies: boolean) {
    this._props.isDesignedForFamilies = isDesignedForFamilies;
    return this;
  }
 
  tagForChildDirectedTreatment(tagForChildDirectedTreatment: boolean) {
    this._props.tagForChildDirectedTreatment = tagForChildDirectedTreatment;
    return this;
  }
}