Sha256: 65b0f2d158ffae2995f7747535423c44d35f5f7e4ca8b802a1d2e51d636638c2

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# -*- encoding: utf-8 -*-

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

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

      def get_categories_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}/categories/stats/sums", params, &block)
        Stats.create_top_stat(resp)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sendgrid4r-1.11.0 lib/sendgrid4r/rest/stats/category.rb
sendgrid4r-1.10.0 lib/sendgrid4r/rest/stats/category.rb