Class: GM::Adn_Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-byte-csjm/config.rb

Constant Summary collapse

ADNADAPTER =
Hash[
  # 'Ads-CN' => 'ABUAdCsjAdapter',
  'UnityAds' => 'CSJMUnityAdapter',
  'Google-Mobile-Ads-SDK'=> 'CSJMAdmobAdapter',
  'BaiduMobAdSDK'=> 'CSJMBaiduAdapter',
  'GDTMobSDK'=> 'CSJMGdtAdapter',
  'SigmobAd-iOS'=> 'CSJMSigmobAdapter',
  'KSAdSDK'=> 'CSJMKsAdapter',
  'KlevinAdSDK'=> 'CSJMKlevinAdapter',
  'MintegralAdSDK'=> 'CSJMMintegralAdapter',
].freeze
SERVERMAPADAPTER =
Hash[
  'unity' => 'CSJMUnityAdapter',
  'admob'=> 'CSJMAdmobAdapter',
  'baidu'=> 'CSJMBaiduAdapter',
  'gdt'=> 'CSJMGdtAdapter',
  'sigmob'=> 'CSJMSigmobAdapter',
  'ks'=> 'CSJMKsAdapter',
  'klevin'=> 'CSJMKlevinAdapter',
  'mtg'=> 'CSJMMintegralAdapter',
].freeze
SERVERMAPADN =
Hash[
  'UnityAds' => 'unity',
  'Google-Mobile-Ads-SDK'=> 'admob',
  'BaiduMobAdSDK'=> 'baidu',
  'GDTMobSDK'=> 'gdt',
  'SigmobAd-iOS'=> 'sigmob',
  'KSAdSDK'=> 'ks',
  'KlevinAdSDK'=> 'klevin',
  'MintegralAdSDK'=> 'mtg',
].freeze

Class Method Summary collapse

Class Method Details

.get_adapter(name) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/cocoapods-byte-csjm/config.rb', line 93

def self.get_adapter(name)
  adapter = ''
  if is_adn?(name)
    adapter = ADNADAPTER[name]
  end
  adapter
end

.get_adapter_from_adn_abbreviation(name) ⇒ Object



81
82
83
# File 'lib/cocoapods-byte-csjm/config.rb', line 81

def self.get_adapter_from_adn_abbreviation(name)
  SERVERMAPADAPTER[name]
end

.get_adn(name) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cocoapods-byte-csjm/config.rb', line 101

def self.get_adn(name)
  adn_name = ''
  if is_adapter?(name)
    ## .index 在调试时候会报错
    ADNADAPTER.select{ |key, value|
    if value == name
      adn_name = key
      break
    end
    true
    }
  end
  adn_name
end

.get_adn_abbreviation(name) ⇒ Object



77
78
79
# File 'lib/cocoapods-byte-csjm/config.rb', line 77

def self.get_adn_abbreviation(name)
  SERVERMAPADN[name]
end

.get_all_adapterObject



116
117
118
# File 'lib/cocoapods-byte-csjm/config.rb', line 116

def self.get_all_adapter
  ADNADAPTER.values
end

.get_all_adnObject



120
121
122
# File 'lib/cocoapods-byte-csjm/config.rb', line 120

def self.get_all_adn
  ADNADAPTER.keys
end

.is_adapter?(name) ⇒ Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/cocoapods-byte-csjm/config.rb', line 89

def self.is_adapter?(name)
  ADNADAPTER.has_value?(name)
end

.is_adn?(name) ⇒ Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/cocoapods-byte-csjm/config.rb', line 85

def self.is_adn?(name)
  ADNADAPTER.has_key?(name)
end