Sha256: d8fa1e6819e737312e4245347d3c944361b27a07274a70d0d544142faca99390

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

module FbErrorMachine
  class MarketingApiErrorScraper

    def self.scrape_marketing_api_errors(version="2.7")
      browser = Watir::Browser.new :phantomjs
      browser.goto("https://developers.facebook.com/docs/marketing-api/error-reference/v#{version}")
      rows = browser.trs.to_a
      rows.shift

      errors = []

      rows.each do |row|
        errors << {
          error_code: ErrorWriter.find_error_code(row),
          description: ErrorWriter.find_description(row),
        }
      end

      browser.close
      ErrorWriter.write_errors(type: 'marketing', errors: errors)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_error_machine-0.1.1 lib/fb_error_machine/marketing_api_error_scraper.rb