Module: Dnsimple::Client::DomainsEmailForwards
- Included in:
- DomainsService
- Defined in:
- lib/dnsimple/client/domains_email_forwards.rb
Instance Method Summary collapse
-
#all_email_forwards(account_id, domain_id, options = {}) ⇒ Dnsimple::CollectionResponse<Dnsimple::Struct::EmailForward>
Lists ALL the email forwards for the domain.
-
#create_email_forward(account_id, domain_id, attributes, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::EmailForward>
Creates an email forward for the domain.
-
#delete_email_forward(account_id, domain_id, email_forward_id, options = {}) ⇒ Dnsimple::Response<nil>
Deletes an email forward for the domain.
-
#email_forward(account_id, domain_id, email_forward_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::EmailForward>
Gets a email forward for the domain.
-
#email_forwards(account_id, domain_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::EmailForward>
Lists the email forwards for the domain.
Instance Method Details
#all_email_forwards(account_id, domain_id, options = {}) ⇒ Dnsimple::CollectionResponse<Dnsimple::Struct::EmailForward>
Lists ALL the email forwards for the domain.
This method is similar to #email_forwards, but instead of returning the results of a specific page it iterates all the pages and returns the entire collection.
Please use this method carefully, as fetching the entire collection will increase the number of requests you send to the API server and you may eventually risk to hit the throttle limit.
45 46 47 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 45 def all_email_forwards(account_id, domain_id, = {}) paginate(:email_forwards, account_id, domain_id, ) end |
#create_email_forward(account_id, domain_id, attributes, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::EmailForward>
Creates an email forward for the domain.
60 61 62 63 64 65 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 60 def create_email_forward(account_id, domain_id, attributes, = {}) Extra.validate_mandatory_attributes(attributes, [:from, :to]) response = client.post(Client.versioned("/%s/domains/%s/email_forwards" % [account_id, domain_id]), attributes, ) Dnsimple::Response.new(response, Struct::EmailForward.new(response["data"])) end |
#delete_email_forward(account_id, domain_id, email_forward_id, options = {}) ⇒ Dnsimple::Response<nil>
Deletes an email forward for the domain.
WARNING: this cannot be undone.
99 100 101 102 103 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 99 def delete_email_forward(account_id, domain_id, email_forward_id, = {}) response = client.delete(Client.versioned("/%s/domains/%s/email_forwards/%s" % [account_id, domain_id, email_forward_id]), nil, ) Dnsimple::Response.new(response, nil) end |
#email_forward(account_id, domain_id, email_forward_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::EmailForward>
Gets a email forward for the domain.
79 80 81 82 83 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 79 def email_forward(account_id, domain_id, email_forward_id, = {}) response = client.get(Client.versioned("/%s/domains/%s/email_forwards/%s" % [account_id, domain_id, email_forward_id]), ) Dnsimple::Response.new(response, Struct::EmailForward.new(response["data"])) end |
#email_forwards(account_id, domain_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::EmailForward>
Lists the email forwards for the domain.
22 23 24 25 26 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 22 def email_forwards(account_id, domain_id, = {}) response = client.get(Client.versioned("/%s/domains/%s/email_forwards" % [account_id, domain_id]), ) Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::EmailForward.new(r) }) end |