dnsimple 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -2
- data/README.md +5 -4
- data/dnsimple.gemspec +3 -3
- data/lib/dnsimple.rb +1 -0
- data/lib/dnsimple/client.rb +37 -11
- data/lib/dnsimple/client/accounts.rb +26 -0
- data/lib/dnsimple/client/clients.rb +15 -1
- data/lib/dnsimple/client/contacts.rb +16 -7
- data/lib/dnsimple/client/domains.rb +20 -6
- data/lib/dnsimple/client/domains_email_forwards.rb +17 -8
- data/lib/dnsimple/client/identity.rb +2 -5
- data/lib/dnsimple/client/registrar.rb +1 -1
- data/lib/dnsimple/client/registrar_auto_renewal.rb +2 -2
- data/lib/dnsimple/client/services.rb +15 -3
- data/lib/dnsimple/client/templates.rb +16 -4
- data/lib/dnsimple/client/templates_records.rb +135 -0
- data/lib/dnsimple/client/tlds.rb +13 -4
- data/lib/dnsimple/client/webhooks.rb +11 -2
- data/lib/dnsimple/client/zones.rb +19 -5
- data/lib/dnsimple/client/zones_records.rb +48 -11
- data/lib/dnsimple/default.rb +2 -2
- data/lib/dnsimple/extra.rb +3 -3
- data/lib/dnsimple/options.rb +53 -0
- data/lib/dnsimple/struct.rb +2 -0
- data/lib/dnsimple/struct/account.rb +3 -0
- data/lib/dnsimple/struct/contact.rb +0 -3
- data/lib/dnsimple/struct/record.rb +2 -2
- data/lib/dnsimple/struct/template_record.rb +34 -0
- data/lib/dnsimple/struct/whoami.rb +30 -0
- data/lib/dnsimple/version.rb +1 -1
- data/spec/dnsimple/client/accounts_spec.rb +31 -0
- data/spec/dnsimple/client/contacts_spec.rb +19 -2
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +18 -1
- data/spec/dnsimple/client/domains_spec.rb +30 -1
- data/spec/dnsimple/client/identity_spec.rb +6 -6
- data/spec/dnsimple/client/services_spec.rb +30 -1
- data/spec/dnsimple/client/templates_records_spec.rb +226 -0
- data/spec/dnsimple/client/templates_spec.rb +30 -1
- data/spec/dnsimple/client/tlds_spec.rb +18 -1
- data/spec/dnsimple/client/webhooks_spec.rb +6 -0
- data/spec/dnsimple/client/zones_records_spec.rb +30 -1
- data/spec/dnsimple/client/zones_spec.rb +30 -1
- data/spec/dnsimple/client_spec.rb +35 -14
- data/spec/dnsimple/options/base_spec.rb +22 -0
- data/spec/dnsimple/options/list_options_spec.rb +100 -0
- data/spec/fixtures.http/accounts/success-account.http +21 -0
- data/spec/fixtures.http/accounts/success-user.http +21 -0
- data/spec/fixtures.http/createContact/created.http +1 -1
- data/spec/fixtures.http/createTemplateRecord/created.http +17 -0
- data/spec/fixtures.http/deleteTemplateRecord/success.http +13 -0
- data/spec/fixtures.http/getContact/success.http +1 -1
- data/spec/fixtures.http/getTemplateRecord/success.http +17 -0
- data/spec/fixtures.http/listContacts/success.http +1 -1
- data/spec/fixtures.http/listTemplateRecords/success.http +17 -0
- data/spec/fixtures.http/notfound-template.http +12 -0
- data/spec/fixtures.http/updateContact/success.http +1 -1
- data/spec/spec_helper.rb +0 -11
- metadata +35 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb3f3b1fc8b0c99b792b0c1a1d6b27830ff2331f
|
4
|
+
data.tar.gz: 1c79d167d1d71d3af51981a326494c1a3b02fb53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f56e2bf1ca4267264aa5730b146de169430497389827745a8ce6bf80bd34dc5f8721454d9c330a83c6684e43f2fbb8ff0d0ec22ad30f70f9892ce64fb952872
|
7
|
+
data.tar.gz: 2574f383a0a03086b280ded7535153f563364e51d015a5499ea18ca93187f4eaa4c14e76109baab246f2837699426683159ece814c37f930edf8c19f5cc86a31
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,25 @@
|
|
3
3
|
This project uses [Semantic Versioning 2.0.0](http://semver.org/).
|
4
4
|
|
5
5
|
|
6
|
+
#### 3.1.0
|
7
|
+
|
8
|
+
- NEW: Added accounts support (GH-113).
|
9
|
+
|
10
|
+
- NEW: Added sorting and filtering support (GH-112).
|
11
|
+
|
12
|
+
- NEW: Added template record support (GH-104).
|
13
|
+
|
14
|
+
- CHANGED: Pagination params must be passed as top level options. Previously they were passed inside `:query` options (GH-116).
|
15
|
+
|
16
|
+
- CHANGED: Authentication credentials presence is no longer validated on the client as it was causing an error getting the access token (GH-74 and GH-102).
|
17
|
+
|
18
|
+
- CHANGED: Setting a custom user-agent no longer overrides the origina user-agent (GH-105).
|
19
|
+
|
20
|
+
- CHANGED: Updated client to use Contact#email (GH-108).
|
21
|
+
|
22
|
+
- REMOVED: Removed support for wildcard accounts (GH-107).
|
23
|
+
|
24
|
+
|
6
25
|
#### 3.0.0
|
7
26
|
|
8
27
|
##### stable
|
@@ -19,7 +38,6 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).
|
|
19
38
|
|
20
39
|
- CHANGED: Error detection is now smarter. If the error is deserializable and contains a message, the message is attached to the exception (GH-94, GH-95, GH-100).
|
21
40
|
|
22
|
-
|
23
41
|
##### beta2
|
24
42
|
|
25
43
|
- FIXED: `state` and `redirect_uri` are not properly passed in the request to exchang the code for an access token (GH-89, GH-90).
|
@@ -42,7 +60,7 @@ Internal changes were made to match conventions adopted in other clients, such a
|
|
42
60
|
|
43
61
|
#### 2.1.0
|
44
62
|
|
45
|
-
- NEW: Add the ability to set headers and pass extra connection params in each API method (GH-64)
|
63
|
+
- NEW: Add the ability to set headers and pass extra connection params in each API method (GH-64)
|
46
64
|
|
47
65
|
#### 2.0.0
|
48
66
|
|
data/README.md
CHANGED
@@ -18,16 +18,16 @@ This library is currently in beta version, the methods and the implementation sh
|
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
21
|
-
|
21
|
+
You can install the gem manually:
|
22
22
|
|
23
23
|
```
|
24
|
-
$ gem install dnsimple
|
24
|
+
$ gem install dnsimple
|
25
25
|
```
|
26
26
|
|
27
|
-
|
27
|
+
Or use Bundler and define it as a dependency in your Gemfile:
|
28
28
|
|
29
29
|
```
|
30
|
-
gem 'dnsimple', '~> 3.0'
|
30
|
+
gem 'dnsimple', '~> 3.0'
|
31
31
|
```
|
32
32
|
|
33
33
|
## Usage
|
@@ -48,6 +48,7 @@ client.identity.whoami.data # execute the call and get the data in one l
|
|
48
48
|
account_id = 1010
|
49
49
|
|
50
50
|
# You can also fetch it from the whoami response
|
51
|
+
# as long as you authenticate with an Account access token
|
51
52
|
whoami = client.identity.whoami.data
|
52
53
|
account_id = whoami.account.id
|
53
54
|
|
data/dnsimple.gemspec
CHANGED
@@ -5,8 +5,8 @@ require 'dnsimple/version'
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'dnsimple'
|
7
7
|
s.version = Dnsimple::VERSION
|
8
|
-
s.authors = ['Anthony Eden', 'Simone Carletti']
|
9
|
-
s.email = ['anthony.eden@dnsimple.com', 'simone.carletti@dnsimple.com']
|
8
|
+
s.authors = ['Anthony Eden', 'Simone Carletti', 'Javier Acero', 'Joseph Caudle', 'Luca Guidi']
|
9
|
+
s.email = ['anthony.eden@dnsimple.com', 'simone.carletti@dnsimple.com', 'javier.acero@dnsimple.com', 'joseph.caudle@dnsimple.com', 'luca.guidi@dnsimple.com']
|
10
10
|
s.homepage = 'https://github.com/aetrion/dnsimple-ruby'
|
11
11
|
s.summary = 'The DNSimple API client for Ruby'
|
12
12
|
s.description = 'The DNSimple API client for Ruby.'
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.extra_rdoc_files = %w( LICENSE.txt )
|
20
20
|
|
21
|
-
s.add_dependency
|
21
|
+
s.add_dependency 'httparty'
|
22
22
|
|
23
23
|
s.add_development_dependency 'rake'
|
24
24
|
s.add_development_dependency 'rspec'
|
data/lib/dnsimple.rb
CHANGED
data/lib/dnsimple/client.rb
CHANGED
@@ -12,8 +12,6 @@ module Dnsimple
|
|
12
12
|
class Client
|
13
13
|
|
14
14
|
HEADER_AUTHORIZATION = "Authorization".freeze
|
15
|
-
WILDCARD_ACCOUNT = "_".freeze
|
16
|
-
|
17
15
|
|
18
16
|
# @return [String] The current API version.
|
19
17
|
API_VERSION = "v2".freeze
|
@@ -73,7 +71,7 @@ module Dnsimple
|
|
73
71
|
# @param [Hash] options The query and header params for the request
|
74
72
|
# @return [HTTParty::Response]
|
75
73
|
def get(path, options = {})
|
76
|
-
execute :get, path, nil, options
|
74
|
+
execute :get, path, nil, options.to_h
|
77
75
|
end
|
78
76
|
|
79
77
|
# Make a HTTP POST request.
|
@@ -155,7 +153,7 @@ module Dnsimple
|
|
155
153
|
# @param [Hash] options The query and header params for the request
|
156
154
|
# @return [HTTParty::Response]
|
157
155
|
def request(method, path, data = nil, options = {})
|
158
|
-
request_options =
|
156
|
+
request_options = request_options(options)
|
159
157
|
|
160
158
|
if data
|
161
159
|
request_options[:headers]["Content-Type"] = content_type(request_options[:headers])
|
@@ -168,29 +166,57 @@ module Dnsimple
|
|
168
166
|
|
169
167
|
private
|
170
168
|
|
169
|
+
def request_options(custom_options = {})
|
170
|
+
base_options.tap do |options|
|
171
|
+
Extra.deep_merge!(options, custom_options)
|
172
|
+
Extra.deep_merge!(options, headers: { "User-Agent" => format_user_agent })
|
173
|
+
add_auth_options!(options)
|
174
|
+
add_proxy_options!(options)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
171
178
|
def base_options
|
172
|
-
|
179
|
+
{
|
173
180
|
format: :json,
|
174
181
|
headers: {
|
175
|
-
|
176
|
-
'User-Agent' => user_agent,
|
182
|
+
"Accept" => "application/json",
|
177
183
|
},
|
178
184
|
}
|
185
|
+
end
|
179
186
|
|
187
|
+
def add_proxy_options!(options)
|
180
188
|
if proxy
|
181
189
|
address, port = proxy.split(":")
|
182
|
-
options
|
190
|
+
options[:http_proxyaddr] = address
|
191
|
+
options[:http_proxyport] = port
|
183
192
|
end
|
193
|
+
end
|
184
194
|
|
195
|
+
def add_auth_options!(options)
|
185
196
|
if password
|
186
197
|
options[:basic_auth] = { username: username, password: password }
|
187
198
|
elsif access_token
|
188
199
|
options[:headers][HEADER_AUTHORIZATION] = "Bearer #{access_token}"
|
189
|
-
else
|
190
|
-
raise Error, 'A password, domain API token or access token is required for all API requests.'
|
191
200
|
end
|
201
|
+
end
|
192
202
|
|
193
|
-
|
203
|
+
# Builds the final user agent to use for HTTP requests.
|
204
|
+
#
|
205
|
+
# If no custom user agent is provided, the default user agent is used.
|
206
|
+
#
|
207
|
+
# dnsimple-ruby/1.0
|
208
|
+
#
|
209
|
+
# If a custom user agent is provided, the final user agent is the combination
|
210
|
+
# of the custom user agent prepended by the default user agent.
|
211
|
+
#
|
212
|
+
# dnsimple-ruby/1.0 customAgentFlag
|
213
|
+
#
|
214
|
+
def format_user_agent
|
215
|
+
if user_agent.to_s.empty?
|
216
|
+
Dnsimple::Default::USER_AGENT
|
217
|
+
else
|
218
|
+
"#{Dnsimple::Default::USER_AGENT} #{user_agent}"
|
219
|
+
end
|
194
220
|
end
|
195
221
|
|
196
222
|
def content_type(headers)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
class Client
|
3
|
+
module Accounts
|
4
|
+
|
5
|
+
# Lists the accounts the authenticated entity has access to.
|
6
|
+
#
|
7
|
+
# @see https://developer.dnsimple.com/v2/accounts
|
8
|
+
#
|
9
|
+
# @example List the accounts:
|
10
|
+
# client.accounts.list
|
11
|
+
#
|
12
|
+
# @param [Hash] options
|
13
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::Account>]
|
14
|
+
#
|
15
|
+
# @raise [Dnsimple::RequestError]
|
16
|
+
def accounts(options = {})
|
17
|
+
response = client.get(Client.versioned("/accounts"), options)
|
18
|
+
|
19
|
+
Dnsimple::Response.new(response, response["data"].map { |r| Struct::Account.new(r) })
|
20
|
+
end
|
21
|
+
alias list accounts
|
22
|
+
alias list_accounts accounts
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module Dnsimple
|
2
2
|
class Client
|
3
3
|
|
4
|
+
# @return [Dnsimple::Client::AccountsService] The account-related API proxy.
|
5
|
+
def accounts
|
6
|
+
@services[:accounts] ||= Client::AccountsService.new(self)
|
7
|
+
end
|
8
|
+
|
4
9
|
# @return [Dnsimple::Client::ContactsService] The contact-related API proxy.
|
5
10
|
def contacts
|
6
11
|
@services[:contacts] ||= Client::ContactsService.new(self)
|
@@ -52,7 +57,7 @@ module Dnsimple
|
|
52
57
|
end
|
53
58
|
|
54
59
|
|
55
|
-
#
|
60
|
+
# Struct
|
56
61
|
class ClientService
|
57
62
|
|
58
63
|
# @return [Dnsimple::Client]
|
@@ -91,6 +96,13 @@ module Dnsimple
|
|
91
96
|
end
|
92
97
|
|
93
98
|
|
99
|
+
require_relative 'accounts'
|
100
|
+
|
101
|
+
class AccountsService < ClientService
|
102
|
+
include Client::Accounts
|
103
|
+
end
|
104
|
+
|
105
|
+
|
94
106
|
require_relative 'contacts'
|
95
107
|
|
96
108
|
class ContactsService < ClientService
|
@@ -142,9 +154,11 @@ module Dnsimple
|
|
142
154
|
|
143
155
|
|
144
156
|
require_relative 'templates'
|
157
|
+
require_relative 'templates_records'
|
145
158
|
|
146
159
|
class TemplatesService < ClientService
|
147
160
|
include Client::Templates
|
161
|
+
include Client::TemplatesRecords
|
148
162
|
end
|
149
163
|
|
150
164
|
|
@@ -11,15 +11,21 @@ module Dnsimple
|
|
11
11
|
# client.contacts.list(1010)
|
12
12
|
#
|
13
13
|
# @example List contacts, provide a specific page
|
14
|
-
# client.contacts.list(1010,
|
14
|
+
# client.contacts.list(1010, page: 2)
|
15
|
+
#
|
16
|
+
# @example List contacts, provide a sorting policy
|
17
|
+
# client.contacts.list(1010, sort: "email:asc")
|
15
18
|
#
|
16
19
|
# @param [Fixnum] account_id the account ID
|
17
|
-
# @param [Hash] options the filtering and sorting
|
20
|
+
# @param [Hash] options the filtering and sorting options
|
21
|
+
# @option options [Integer] :page current page (pagination)
|
22
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
23
|
+
# @option options [String] :sort sorting policy
|
18
24
|
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Contact>]
|
19
25
|
#
|
20
26
|
# @raise [Dnsimple::RequestError]
|
21
27
|
def contacts(account_id, options = {})
|
22
|
-
response = client.get(Client.versioned("/%s/contacts" % [account_id]), options)
|
28
|
+
response = client.get(Client.versioned("/%s/contacts" % [account_id]), Options::ListOptions.new(options))
|
23
29
|
|
24
30
|
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Contact.new(r) })
|
25
31
|
end
|
@@ -38,7 +44,10 @@ module Dnsimple
|
|
38
44
|
# @see #contacts
|
39
45
|
#
|
40
46
|
# @param [Fixnum] account_id the account ID
|
41
|
-
# @param [Hash] options the filtering and sorting
|
47
|
+
# @param [Hash] options the filtering and sorting options
|
48
|
+
# @option options [Integer] :page current page (pagination)
|
49
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
50
|
+
# @option options [String] :sort sorting policy
|
42
51
|
# @return [Dnsimple::CollectionResponse<Dnsimple::Struct::Contact>]
|
43
52
|
#
|
44
53
|
# @raise [Dnsimple::RequestError]
|
@@ -58,7 +67,7 @@ module Dnsimple
|
|
58
67
|
#
|
59
68
|
# @raise [Dnsimple::RequestError]
|
60
69
|
def create_contact(account_id, attributes, options = {})
|
61
|
-
Extra.validate_mandatory_attributes(attributes, [:first_name, :last_name, :address1, :city, :state_province, :postal_code, :country, :phone, :
|
70
|
+
Extra.validate_mandatory_attributes(attributes, [:first_name, :last_name, :address1, :city, :state_province, :postal_code, :country, :phone, :email])
|
62
71
|
response = client.post(Client.versioned("/%s/contacts" % [account_id]), attributes, options)
|
63
72
|
|
64
73
|
Dnsimple::Response.new(response, Struct::Contact.new(response["data"]))
|
@@ -69,7 +78,7 @@ module Dnsimple
|
|
69
78
|
#
|
70
79
|
# @see https://developer.dnsimple.com/v2/contacts/#get
|
71
80
|
#
|
72
|
-
# @param [Fixnum
|
81
|
+
# @param [Fixnum] account_id the account ID
|
73
82
|
# @param [#to_s] contact_id the contact ID
|
74
83
|
# @param [Hash] options
|
75
84
|
# @return [Dnsimple::Response<Dnsimple::Struct::Contact>]
|
@@ -106,7 +115,7 @@ module Dnsimple
|
|
106
115
|
#
|
107
116
|
# @see https://developer.dnsimple.com/v2/contacts/#delete
|
108
117
|
#
|
109
|
-
# @param [Fixnum
|
118
|
+
# @param [Fixnum] account_id the account ID
|
110
119
|
# @param [#to_s] contact_id the contact ID
|
111
120
|
# @param [Hash] options
|
112
121
|
# @return [Dnsimple::Response<nil>]
|
@@ -11,15 +11,25 @@ module Dnsimple
|
|
11
11
|
# client.domains.list(1010)
|
12
12
|
#
|
13
13
|
# @example List domains, provide a specific page
|
14
|
-
# client.domains.list(1010,
|
14
|
+
# client.domains.list(1010, page: 2)
|
15
|
+
#
|
16
|
+
# @example List domains, provide a sorting policy
|
17
|
+
# client.domains.list(1010, sort: "expires_on:asc")
|
18
|
+
#
|
19
|
+
# @example List domains, provide a filtering policy
|
20
|
+
# client.domains.list(1010, filter: { name_like: "example" })
|
15
21
|
#
|
16
22
|
# @param [Fixnum] account_id the account ID
|
17
|
-
# @param [Hash] options the filtering and sorting
|
23
|
+
# @param [Hash] options the filtering and sorting options
|
24
|
+
# @option options [Integer] :page current page (pagination)
|
25
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
26
|
+
# @option options [String] :sort sorting policy
|
27
|
+
# @option options [Hash] :filter filtering policy
|
18
28
|
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Domain>]
|
19
29
|
#
|
20
30
|
# @raise [Dnsimple::RequestError]
|
21
31
|
def domains(account_id, options = {})
|
22
|
-
response = client.get(Client.versioned("/%s/domains" % [account_id]), options)
|
32
|
+
response = client.get(Client.versioned("/%s/domains" % [account_id]), Options::ListOptions.new(options))
|
23
33
|
|
24
34
|
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Domain.new(r) })
|
25
35
|
end
|
@@ -39,6 +49,10 @@ module Dnsimple
|
|
39
49
|
#
|
40
50
|
# @param [Fixnum] account_id the account ID
|
41
51
|
# @param [Hash] options the filtering and sorting option
|
52
|
+
# @option options [Integer] :page current page (pagination)
|
53
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
54
|
+
# @option options [String] :sort sorting policy
|
55
|
+
# @option options [Hash] :filter filtering policy
|
42
56
|
# @return [Dnsimple::CollectionResponse<Dnsimple::Struct::Domain>]
|
43
57
|
#
|
44
58
|
# @raise [Dnsimple::RequestError]
|
@@ -70,7 +84,7 @@ module Dnsimple
|
|
70
84
|
#
|
71
85
|
# @see https://developer.dnsimple.com/v2/domains/#get
|
72
86
|
#
|
73
|
-
# @param [Fixnum
|
87
|
+
# @param [Fixnum] account_id the account ID
|
74
88
|
# @param [#to_s] domain_id The domain ID or domain name
|
75
89
|
# @param [Hash] options
|
76
90
|
# @return [Dnsimple::Response<Dnsimple::Struct::Domain>]
|
@@ -89,7 +103,7 @@ module Dnsimple
|
|
89
103
|
#
|
90
104
|
# @see https://developer.dnsimple.com/v2/domains/#delete
|
91
105
|
#
|
92
|
-
# @param [Fixnum
|
106
|
+
# @param [Fixnum] account_id the account ID
|
93
107
|
# @param [#to_s] domain_id The domain ID or domain name
|
94
108
|
# @param [Hash] options
|
95
109
|
# @return [Dnsimple::Response<nil>]
|
@@ -107,7 +121,7 @@ module Dnsimple
|
|
107
121
|
#
|
108
122
|
# @see https://developer.dnsimple.com/v2/domains/#reset-token
|
109
123
|
#
|
110
|
-
# @param [Fixnum
|
124
|
+
# @param [Fixnum] account_id the account ID
|
111
125
|
# @param [#to_s] domain_id The domain ID or domain name
|
112
126
|
# @param [Hash] options
|
113
127
|
# @return [Dnsimple::Response<nil>]
|
@@ -10,17 +10,23 @@ module Dnsimple
|
|
10
10
|
# client.domains.email_forwards(1010, "example.com")
|
11
11
|
#
|
12
12
|
# @example List email forwards, provide a specific page
|
13
|
-
# client.domains.email_forwards(1010, "example.com",
|
13
|
+
# client.domains.email_forwards(1010, "example.com", page: 2)
|
14
14
|
#
|
15
|
-
# @
|
15
|
+
# @example List email forwards, provide a sorting policy
|
16
|
+
# client.domains.email_forwards(1010, "example.com", sort: "from:asc")
|
17
|
+
#
|
18
|
+
# @param [Fixnum] account_id the account ID
|
16
19
|
# @param [#to_s] domain_id The domain ID or domain name
|
17
|
-
# @param [Hash] options the filtering and sorting
|
20
|
+
# @param [Hash] options the filtering and sorting options
|
21
|
+
# @option options [Integer] :page current page (pagination)
|
22
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
23
|
+
# @option options [String] :sort sorting policy
|
18
24
|
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::EmailForward>]
|
19
25
|
#
|
20
26
|
# @raise [Dnsimple::NotFoundError]
|
21
27
|
# @raise [Dnsimple::RequestError]
|
22
28
|
def email_forwards(account_id, domain_id, options = {})
|
23
|
-
response = client.get(Client.versioned("/%s/domains/%s/email_forwards" % [account_id, domain_id]), options)
|
29
|
+
response = client.get(Client.versioned("/%s/domains/%s/email_forwards" % [account_id, domain_id]), Options::ListOptions.new(options))
|
24
30
|
|
25
31
|
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::EmailForward.new(r) })
|
26
32
|
end
|
@@ -36,9 +42,12 @@ module Dnsimple
|
|
36
42
|
# @see https://developer.dnsimple.com/v2/domains/email-forwards/#list
|
37
43
|
# @see #email_forwards
|
38
44
|
#
|
39
|
-
# @param [Fixnum
|
45
|
+
# @param [Fixnum] account_id the account ID
|
40
46
|
# @param [#to_s] domain_id The domain ID or domain name
|
41
47
|
# @param [Hash] options the filtering and sorting option
|
48
|
+
# @option options [Integer] :page current page (pagination)
|
49
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
50
|
+
# @option options [String] :sort sorting policy
|
42
51
|
# @return [Dnsimple::CollectionResponse<Dnsimple::Struct::EmailForward>]
|
43
52
|
#
|
44
53
|
# @raise [Dnsimple::RequestError]
|
@@ -50,7 +59,7 @@ module Dnsimple
|
|
50
59
|
#
|
51
60
|
# @see https://developer.dnsimple.com/v2/domains/email-forwards/#create
|
52
61
|
#
|
53
|
-
# @param [Fixnum
|
62
|
+
# @param [Fixnum] account_id the account ID
|
54
63
|
# @param [#to_s] domain_id The domain ID or domain name
|
55
64
|
# @param [Hash] attributes
|
56
65
|
# @param [Hash] options
|
@@ -68,7 +77,7 @@ module Dnsimple
|
|
68
77
|
#
|
69
78
|
# @see https://developer.dnsimple.com/v2/domains/email-forwards/#get
|
70
79
|
#
|
71
|
-
# @param [Fixnum
|
80
|
+
# @param [Fixnum] account_id the account ID
|
72
81
|
# @param [#to_s] domain_id The domain ID or domain name
|
73
82
|
# @param [#to_s] email_forward_id The email forward ID
|
74
83
|
# @param [Hash] options
|
@@ -88,7 +97,7 @@ module Dnsimple
|
|
88
97
|
#
|
89
98
|
# @see https://developer.dnsimple.com/v2/domains/email-forwards/#delete
|
90
99
|
#
|
91
|
-
# @param [Fixnum
|
100
|
+
# @param [Fixnum] account_id the account ID
|
92
101
|
# @param [#to_s] domain_id The domain ID or domain name
|
93
102
|
# @param [#to_s] email_forward_id The email forward ID
|
94
103
|
# @param [Hash] options
|