Module: SendGrid4r::REST::Stats::Category

Includes:
Request
Included in:
API
Defined in:
lib/sendgrid4r/rest/stats/category.rb

Overview

SendGrid Web API v3 Stats - Category

Constant Summary

Constants included from Request

Request::BASE_URL

Instance Method Summary collapse

Methods included from Request

#create_args, #delete, #execute, #finish, #get, #patch, #post, #process_array_params, #process_url_params, #put

Instance Method Details

#get_categories_stats(start_date:, end_date: nil, aggregated_by: nil, categories:, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sendgrid4r/rest/stats/category.rb', line 11

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)
  finish(resp, @raw_resp) { |r| Stats.create_top_stats(r) }
end

#get_categories_stats_sums(start_date:, end_date: nil, sort_by_metric: nil, sort_by_direction: nil, limit: nil, offset: nil, &block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sendgrid4r/rest/stats/category.rb', line 23

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)
  finish(resp, @raw_resp) { |r| Stats.create_top_stat(r) }
end