Class: Yandex360::DomainPoliciesResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/yandex360/resources/domain_policies.rb

Overview

Domain level rules for incoming mail: which senders are accepted, rejected or forced to spam.

See https://yandex.ru/dev/api360/doc/ru/ref/DomainPolicies/

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Yandex360::Resource

Instance Method Details

#list(org_id:) ⇒ Object



9
10
11
12
# File 'lib/yandex360/resources/domain_policies.rb', line 9

def list(org_id:)
  validate_required_params({org_id: org_id}, [:org_id])
  DomainPolicy.new get("/admin/v1/org/#{org_id}/mail/routing/policies").body
end

#set(org_id:, rules:) ⇒ Object

Replaces the whole rule set: the API takes the full list, not a patch, so anything left out is removed.



16
17
18
19
# File 'lib/yandex360/resources/domain_policies.rb', line 16

def set(org_id:, rules:)
  validate_required_params({org_id: org_id, rules: rules}, %i[org_id rules])
  Response.new put("/admin/v1/org/#{org_id}/mail/routing/policies", body: {rules: rules}).body
end