Module: SendGrid4r::REST::Stats::Subuser

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

Overview

SendGrid Web API v3 Stats - Subuser

Constant Summary

Constants included from Request

Request::BASE_URL

Instance Method Summary collapse

Methods included from Request

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

Instance Method Details

#get_subusers_stats(start_date:, end_date: nil, aggregated_by: nil, subusers:, &block) ⇒ Object



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

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

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



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

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