Class: CloudflareClient::VirtualDnsCluster::Analytic

Inherits:
CloudflareClient::VirtualDnsCluster show all
Defined in:
lib/cloudflare_client/virtual_dns_cluster/analytic.rb

Constant Summary

Constants inherited from CloudflareClient::VirtualDnsCluster

VALID_SCOPES

Constants inherited from CloudflareClient

API_BASE, POSSIBLE_API_SETTINGS, CloudflareClient::VALID_BUNDLE_METHODS, CloudflareClient::VALID_DIRECTIONS, CloudflareClient::VALID_MATCHES, CloudflareClient::VERSION

Instance Attribute Summary collapse

Attributes inherited from CloudflareClient::VirtualDnsCluster

#uri_prefix

Instance Method Summary collapse

Methods inherited from CloudflareClient::VirtualDnsCluster

#create, #delete, #list, #show, #update

Constructor Details

#initialize(args) ⇒ Analytic

virtual DNS Analytics (users and orgs)



7
8
9
10
11
# File 'lib/cloudflare_client/virtual_dns_cluster/analytic.rb', line 7

def initialize(args)
  @virtual_dns_id = args.delete(:virtual_dns_id)
  id_check(:virtual_dns_id, virtual_dns_id)
  super(**args)
end

Instance Attribute Details

#virtual_dns_idObject (readonly)

Returns the value of attribute virtual_dns_id.



2
3
4
# File 'lib/cloudflare_client/virtual_dns_cluster/analytic.rb', line 2

def virtual_dns_id
  @virtual_dns_id
end

Instance Method Details

#report(dimensions:, metrics:, since_ts:, until_ts:, filters: nil, sort: nil, limit: nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cloudflare_client/virtual_dns_cluster/analytic.rb', line 13

def report(dimensions:, metrics:, since_ts:, until_ts:, filters: nil, sort: nil, limit: nil)
  non_empty_array_check(:dimensions, dimensions)
  non_empty_array_check(:metrics, metrics)
  iso8601_check(:since_ts, since_ts)
  iso8601_check(:until_ts, until_ts)

  params = {dimensions: dimensions, metrics: metrics, since: since_ts, until: until_ts}

  unless sort.nil?
    non_empty_array_check(:sort, sort)
    params[:sort] = sort
  end

  unless filters.nil?
    basic_type_check(:filters, filters, String)
    params[:filters] = filters
  end

  unless limit.nil?
    basic_type_check(:limit, limit, Integer)
    params[:limit] = limit
  end

  cf_get(path: "#{uri_prefix}/virtual_dns/#{virtual_dns_id}/dns_analytics/report", params: params)
end