Class: Pindo::Command::Utils::Boss

Inherits:
Pindo::Command::Utils show all
Defined in:
lib/pindo/command/utils/boss.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Boss

Returns a new instance of Boss.



52
53
54
55
56
57
58
59
60
61
# File 'lib/pindo/command/utils/boss.rb', line 52

def initialize(argv)

    @platform = argv.option('platform')
    @bundleid = argv.option('bundleid')
    @appversion = argv.option('appversion')
    @apptype = argv.option('apptype') || "FunnyApp"

    super(argv)
    @additional_args = argv.remainder!
end

Class Method Details

.get_config(boss_client: nil, app_version: nil, bundle_id: nil, platform: nil) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/pindo/command/utils/boss.rb', line 173

def self.get_config(boss_client:nil, app_version:nil, bundle_id:nil, platform:nil)

    puts 
    puts 
    puts "  bundle_id:#{bundle_id}"
    puts "  app_version:#{app_version}"
    puts "  platform:#{platform}"
    puts "  Base Url:#{boss_client.base_url}"
    puts "  App Type:#{boss_client.app_type}"
    puts 
    puts 

    app_info_dict = {
      app_version:"",
      bundle_id:"",
      platform:"",
      api_version:"1.0",
      apps_flyer_info:{},
      login_device_id: "",
      device_info:{}
    }

    

    device_info = boss_client.get_default_device_info
    # puts device_info
    app_info_dict[:login_device_id] = device_info.device_id
    app_info_dict[:device_info] = device_info
    app_info_dict[:apps_flyer_info] = boss_client.get_default_device_info


    app_info_dict[:app_version] = app_version || "1.0.0"
    app_info_dict[:bundle_id] = bundle_id || "com.heroneverdie101.fancyapp"
    app_info_dict[:platform] = platform || "iOS_Funny_Release"


    data_json =  boss_client.refresh_setting(app_info_dict:app_info_dict)

    return data_json

end

.optionsObject



41
42
43
44
45
46
47
48
49
# File 'lib/pindo/command/utils/boss.rb', line 41

def self.options
  [
    ['--platform', '设置平台号: --platform=\"iOS_Test\"'],
    ['--bundleid', '设置bundle id: --bundleid=\"your url\"'],
    ['--appversion', '设置app的版本号: --appversion=\"1.0.0\"'],
    ['--apptype', '设置app的类型, 默认是FancyApp,属于个性化类型: --apptype=\"FancyApp\"'],
    
  ].concat(super)
end

Instance Method Details

#runObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/pindo/command/utils/boss.rb', line 68

def run


    # app_info_dict = {
    #   app_version:"",
    #   bundle_id:"",
    #   platform:"",
    #   api_version:"1.0",
    #   apps_flyer_info:{},
    #   login_device_id: "",
    #   device_info:{}
    # }

    # @boss_client = BossClient.new(app_type:"FancyApp", is_dev:false)

    # device_info = @boss_client.get_default_device_info
    # # puts device_info
    # app_info_dict[:login_device_id] = device_info.device_id
    # app_info_dict[:device_info] = device_info
    # app_info_dict[:apps_flyer_info] = @boss_client.get_default_device_info



    # app_version = "1.0.0"
    # bundle_id = "com.heroneverdie101.fancyapp"
    # platform = "iOS_Funny_Release"

    # app_info_dict[:app_version] = app_version || "1.0.0"
    # app_info_dict[:bundle_id] = bundle_id || "com.heroneverdie101.fancyapp"
    # app_info_dict[:platform] = platform || "iOS_Funny_Release"


    # data_json =  @boss_client.refresh_setting(app_info_dict:app_info_dict)

    # if !data_json["data"].nil? 
    #     puts JSON.pretty_generate(data_json["data"])   
    # else
    #     puts JSON.pretty_generate(data_json)   
    # end

    @appconfig_file = './config.json'
    @appconfig_file=File::expand_path(@appconfig_file)

    base_url = nil
    if File.exist?(@appconfig_file)
        current_config_json=JSON.parse(File.read(@appconfig_file))
        
        if @apptype.nil?
            @apptype = current_config_json["project_info"]["app_type"]
        end

        if @appversion.nil?
            @appversion = current_config_json["app_info"]["app_version"]
        end

        if @bundleid.nil?
            @bundleid = current_config_json["app_info"]["app_identifier"]
        end

        if @platform.nil?
            @platform = current_config_json["app_setting"]["kGUKeyAppPlatform"]
        end
        
        if base_url.nil?
            base_url = current_config_json["app_setting"]["kGUKeyAppClientHost"]
        end
    end

    app_version = @appversion || "1.0.0"
    bundle_id = @bundleid || "com.heroneverdie101.fancyapp"
    platform = @platform || "iOS_Funny_Release"
    apptype = @apptype || "FunnyApp"

    boss_client = BossClient.new(app_type:apptype, is_dev:false, base_url:base_url)
    data_json =  Boss::get_config(boss_client:boss_client, app_version:app_version, bundle_id:bundle_id, platform:platform)

    if !data_json["data"].nil? 
        puts JSON.pretty_generate(data_json["data"])   
    else
        puts JSON.pretty_generate(data_json)   
    end


    is_in_review_status = BossClient::is_in_review_status_with_confirm_key(confirm_key:data_json["data"]["confirm_key"])
    puts 
    puts 
    puts "  bundle_id:#{bundle_id}"
    puts "  app_version:#{app_version}"
    puts "  platform:#{platform}"
    puts "  Base Url:#{boss_client.base_url}"
    puts "  App Type:#{boss_client.app_type}"
    puts 

    if is_in_review_status
        puts "  当前设备,当前参数是审核状态".bold.yellow
    else
        puts "  当前设备,当前参数是非审核状态".bold.blue
    end
    puts
    puts 


end

#validate!Object



63
64
65
66
# File 'lib/pindo/command/utils/boss.rb', line 63

def validate!

    super
end