Sha256: a3fbadcf41b05620c0f49cb1dc65c09e1f21ca27414e69dd0dfdbb66a4755ca8

Contents?: true

Size: 913 Bytes

Versions: 25

Compression:

Stored size: 913 Bytes

Contents

require 'date'
require_relative 'base_client'
require 'rest-client'

class AdopsReportScrapper::SpringserveClient < AdopsReportScrapper::BaseClient
  private

  def init_client
  end

  def before_quit_with_error
  end

  private

  def scrap
    date_str = @date.strftime('%Y-%m-%d')

    response = RestClient.post "https://video.springserve.com/api/v0/auth", email: @login, password: @secret
    data = JSON.parse response
    token = data['token']

    headers = { content_type: :json, accept: :json, authorization: token }

    response = RestClient.post "https://video.springserve.com/api/v0/report", { timezone: 'America/New_York', date_range: 'Yesterday', interval: 'cumulative', dimensions: ['country', 'supply_tag_id']}.to_json, headers
    data = JSON.parse response
    header = data[0].keys
    @data = [header]
    @data += data.map do |datum|
      header.map { |key| datum[key] }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
adops_report_scrapper-0.2.37 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.35 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.34 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.33 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.32 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.31 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.30 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.29 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.28 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.27 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.26 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.25 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.24 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.23 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.22 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.21 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.20 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.19 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.18 lib/adops_report_scrapper/springserve_client.rb
adops_report_scrapper-0.2.17 lib/adops_report_scrapper/springserve_client.rb