Sha256: cb9d274c8e9bbc1dca4b515babe33589a0d8438b17170175adc1261f89021e55

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

# -*- encoding: utf-8 -*-
$LOAD_PATH.unshift File.dirname(__FILE__)

require 'sendgrid4r/rest/request'

module SendGrid4r
  module REST
    module Stats
      #
      # SendGrid Web API v3 Stats - Subuser
      #
      module Subuser
        include SendGrid4r::REST::Request

        def get_subusers_stats(
            start_date:, end_date: nil, aggregated_by: nil, subusers:, &block)
          params = {
            start_date: start_date,
            end_date: end_date,
            aggregated_by: aggregated_by,
            subusers: subusers
          }
          resp = get(@auth, "#{BASE_URL}/subusers/stats", params, &block)
          SendGrid4r::REST::Stats.create_top_stats(resp)
        end

        def get_subusers_stats_sums(
            start_date:, end_date: nil, sort_by_metric: nil,
            sort_by_direction: nil, limit: nil, offset: nil, &block)
          params = {
            start_date: start_date,
            end_date: end_date,
            sort_by_metric: sort_by_metric,
            sort_by_direction: sort_by_direction,
            limit: limit,
            offset: offset
          }
          resp = get(@auth, "#{BASE_URL}/subusers/stats/sums", params, &block)
          SendGrid4r::REST::Stats.create_top_stat(resp)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sendgrid4r-1.5.0 lib/sendgrid4r/rest/stats/subuser.rb
sendgrid4r-1.4.0 lib/sendgrid4r/rest/stats/subuser.rb
sendgrid4r-1.3.0 lib/sendgrid4r/rest/stats/subuser.rb
sendgrid4r-1.2.1 lib/sendgrid4r/rest/stats/subuser.rb
sendgrid4r-1.2.0 lib/sendgrid4r/rest/stats/subuser.rb
sendgrid4r-1.1.0 lib/sendgrid4r/rest/stats/subuser.rb
sendgrid4r-1.0.0 lib/sendgrid4r/rest/stats/subuser.rb
sendgrid4r-0.5.0 lib/sendgrid4r/rest/stats/subuser.rb
sendgrid4r-0.4.0 lib/sendgrid4r/rest/stats/subuser.rb