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.
56 57 58 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 56 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.
71 72 73 74 75 76 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 71 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.
110 111 112 113 114 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 110 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.
90 91 92 93 94 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 90 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.
30 31 32 33 34 |
# File 'lib/dnsimple/client/domains_email_forwards.rb', line 30 def email_forwards(account_id, domain_id, = {}) response = client.get(Client.versioned("/%s/domains/%s/email_forwards" % [account_id, domain_id]), Options::ListOptions.new()) Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::EmailForward.new(r) }) end |