Method: Appium::Core::Base::Device::ScreenRecord#initialize

Defined in:
lib/appium_lib_core/common/device/screen_record.rb

#initialize(remote_path: nil, user: nil, pass: nil, method: 'PUT', file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil) ⇒ ScreenRecord

Returns a new instance of ScreenRecord.


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
# File 'lib/appium_lib_core/common/device/screen_record.rb', line 28

def initialize(remote_path: nil, user: nil, pass: nil, method: 'PUT',
               file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil)
  @upload_option = if remote_path.nil?
                     {}
                   else
                     unless METHOD.member?(method.to_s.upcase)
                       raise ::Appium::Core::Error::ArgumentError,
                             'method should be POST or PUT'
                     end

                     option = {}
                     option[:remotePath] = remote_path
                     option[:user] = user unless user.nil?
                     option[:pass] = pass unless pass.nil?
                     option[:method] = method
                     option[:fileFieldName] = file_field_name unless file_field_name.nil?
                     option[:formFields] = form_fields unless form_fields.nil?
                     option[:headers] = headers unless headers.nil?
                     option
                   end

  return if force_restart.nil?

  unless [true, false].member?(force_restart)
    raise ::Appium::Core::Error::ArgumentError,
          'force_restart should be true or false'
  end

  @upload_option[:forceRestart] = force_restart
end