Method: Codes::ItunesConnect#initialize

Defined in:
lib/codes/itunes_connect/itunes_connect.rb

#initializeItunesConnect

Returns a new instance of ItunesConnect.



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
60
61
62
# File 'lib/codes/itunes_connect/itunes_connect.rb', line 35

def initialize
  super

  return if Helper.is_test?

  Capybara.run_server = false
  Capybara.default_driver = :poltergeist
  Capybara.javascript_driver = :poltergeist
  Capybara.current_driver = :poltergeist
  Capybara.app_host = ITUNESCONNECT_URL

  # Since Apple has some SSL errors, we have to configure the client properly:
  # https://github.com/ariya/phantomjs/issues/11239
  Capybara.register_driver :poltergeist do |a|
    conf = ['--debug=no', '--ignore-ssl-errors=yes', '--ssl-protocol=TLSv1']
    Capybara::Poltergeist::Driver.new(a, {
      phantomjs: Phantomjs.path,
      phantomjs_options: conf,
      phantomjs_logger: File.open("/tmp/poltergeist_log.txt", "a"),
      js_errors: false,
      timeout: 90
    })
  end

  page.driver.headers = { "Accept-Language" => "en" }

  
end