Class: Pindo::Command::Utils::Tgate
- Inherits:
-
Pindo::Command::Utils
- Object
- Pindo::Command
- Pindo::Command::Utils
- Pindo::Command::Utils::Tgate
- Defined in:
- lib/pindo/command/utils/tgate.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Tgate
constructor
A new instance of Tgate.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Tgate
Returns a new instance of Tgate.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/pindo/command/utils/tgate.rb', line 66 def initialize(argv) @args_env_options = argv.option('env') @args_type_options = argv.option('type') @args_status_options = argv.option('status') @args_deviceid_options = argv.option('deviceid') @args_idfa_options = argv.option('idfa') @args_sbsid_options = argv.option('sbsid') @args_sutid_options = argv.option('sutid') @args_tzlid_options = argv.option('tzlid') super(argv) @additional_args = argv.remainder! end |
Class Method Details
.options ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/pindo/command/utils/tgate.rb', line 52 def self. [ ['--env', '指定的dev或者prod环境: --env=dev / prod'], ['--type', '指定的type类型: --type=ip / device'], ['--status', '指定需要修改状态: --status=normal / black / super_white '], ['--deviceid', '指定手机设备deviceid: --deviceid=newvalue'], ['--idfa', '指定手机设备idfa: --idfa=newvalue'], ['--sbsid', '指定手机设备sbsid: --sbsid=newvalue'], ['--sutid', '指定手机设备sutid: --sutid=newvalue'], ['--tzlid', '指定手机设备tzlid: --tzlid=newvalue'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
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 171 172 173 |
# File 'lib/pindo/command/utils/tgate.rb', line 87 def run @tgate_client = TgateClient.new(base_usrl:pindo_single_config.tgate_base_url, req_config:pindo_single_config.tgate_req_config) current_device_info = Pindo::DeviceInfo.new if !@args_deviceid_options.nil? current_device_info.device_id = @args_deviceid_options end if !@args_idfa_options.nil? current_device_info.device_id = @args_idfa_options end if !@args_sbsid_options.nil? current_device_info.device_id = @args_sbsid_options end if !@args_sutid_options.nil? current_device_info.device_id = @args_sutid_options end if !@args_tzlid_options.nil? current_device_info.device_id = @args_tzlid_options end puts puts puts "=========================================================================================================" puts "=========================================================================================================" puts puts "111" if !@args_status_options.nil? puts @args_status_options puts "112" env = "dev" if !@args_env_options.nil? env = @args_env_options end type = "ip" if !@args_type_options.nil? && @args_type_options.eql?("device") type = @args_type_options end to_status = "normal" if !@args_status_options.nil? to_status = @args_status_options end puts "当前设备信息:" puts JSON.pretty_generate(JSON.parse(current_device_info.to_json)) puts @tgate_client.post_update_gate_status(env_mode:env, type:type, to_status:to_status, device_info:current_device_info) else puts "当前设备信息:" puts JSON.pretty_generate(JSON.parse(current_device_info.to_json)) puts end # current_device_info = Pindo::DeviceInfo.new # Tgate.post_update_gate_status(env_mode:"dev", type:"ip", to_status:"normal", device_info:current_device_info) # Tgate.post_update_gate_status(env_mode:"dev", type:"device", to_status:"normal", device_info:current_device_info) # Tgate.post_update_gate_status(env_mode:"prod", type:"ip", to_status:"normal", device_info:current_device_info) # Tgate.post_update_gate_status(env_mode:"prod", type:"device", to_status:"normal", device_info:current_device_info) response_data = @tgate_client.get_gate_status(device_info:current_device_info) puts JSON.pretty_generate(response_data) puts puts "=========================================================================================================" puts "=========================================================================================================" puts end |
#validate! ⇒ Object
82 83 84 85 |
# File 'lib/pindo/command/utils/tgate.rb', line 82 def validate! super end |