dnsmadeeasy 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 071e02ddbb88d13234c3a135672e186062472b44f6a0b3227fd4f9b5c5097205
4
- data.tar.gz: '04249c110d948a410e2235716b2e05c70fa76667a7dd338d409883f8f03dfa6d'
3
+ metadata.gz: d76d863a9aad518d693425c6f30c38ab00cfd265c2bd0f01657e357fa0d296e0
4
+ data.tar.gz: 6b0d42f29ae86a30cab7e47447381d2ce3d6b24b69b9073eda3d75dc59d78efa
5
5
  SHA512:
6
- metadata.gz: df525957ac6b092b428fbd236e85b19ea0d5fda02b7c3a91d813e06ac22376ff7c94e5434fb4b39aa90969c03f926c73efb73b9704686f44c7b84ca10121a8e5
7
- data.tar.gz: 356ea81dffbf405a73ffce3e0c8278e6b329746769c983b9397793c50773ec3ec853b430f6f31781f5e9f3a1ca424e3a173a7c54d5727ac79a9be94a081de7ea
6
+ metadata.gz: ce16dfcdd6f2cf2d2215b77be7c00b8eb3021ea8d10f431e2c38f65422967a710bc5885316fd944b95297d1a5484e021c69de878a3bee65c3a6c0a34236576b0
7
+ data.tar.gz: 734ad666cb687601a7570938a2513e15a53a002e1cb286683274ae6bef1eece1d57e2ab8ccd1f646bf3a398328fdf36268f911d65158575d38033791a8f4d224
Binary file
@@ -0,0 +1,36 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+
7
+ pull_request:
8
+ branches: [ master ]
9
+
10
+ jobs:
11
+ build:
12
+
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+
18
+ - name: Set up Ruby 2.7
19
+ uses: actions/setup-ruby@v1
20
+ with:
21
+ ruby-version: 2.7.x
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ gem install bundler
26
+ bundle install --jobs 4 --retry 3
27
+
28
+ - name: Run all specs
29
+ run: |
30
+ bundle exec rspec --format=documentation
31
+
32
+ - name: Run Rubocop
33
+ run: |
34
+ bundle exec rubocop
35
+
36
+
@@ -1,2 +1,7 @@
1
+ # vim: ft=yaml
1
2
  inherit_from: .rubocop_todo.yml
2
3
 
4
+ Naming/HeredocDelimiterNaming:
5
+ Enabled: false
6
+
7
+
@@ -1,19 +1,47 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-12-03 14:53:41 -0800 using RuboCop version 0.77.0.
3
+ # on 2020-04-14 21:02:14 -0700 using RuboCop version 0.81.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 3
9
+ # Offense count: 2
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
12
+ Layout/EmptyLineBetweenDefs:
13
+ Exclude:
14
+ - 'lib/dme.rb'
15
+ - 'lib/dnsmadeeasy/api/client.rb'
16
+
17
+ # Offense count: 1
10
18
  # Cop supports --auto-correct.
11
19
  # Configuration parameters: EnforcedStyle.
12
- # SupportedStyles: space, no_space
20
+ # SupportedStyles: empty_lines, no_empty_lines
21
+ Layout/EmptyLinesAroundBlockBody:
22
+ Exclude:
23
+ - 'spec/lib/dnsmadeeasy/runner_spec.rb'
24
+
25
+ # Offense count: 2
26
+ # Cop supports --auto-correct.
27
+ # Configuration parameters: EnforcedStyle.
28
+ # SupportedStyles: squiggly, active_support, powerpack, unindent
13
29
  Layout/HeredocIndentation:
14
- Exclude:
15
- - dnsmadeeasy.gemspec
30
+ Exclude:
31
+ - 'dnsmadeeasy.gemspec'
32
+
33
+ # Offense count: 1
34
+ # Cop supports --auto-correct.
35
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
36
+ # SupportedStyles: aligned, indented
37
+ Layout/MultilineOperationIndentation:
38
+ Exclude:
39
+ - 'lib/dnsmadeeasy/runner.rb'
16
40
 
41
+ # Offense count: 3
42
+ # Cop supports --auto-correct.
43
+ # Configuration parameters: EnforcedStyle.
44
+ # SupportedStyles: space, no_space
17
45
  Layout/SpaceInsideParens:
18
46
  Exclude:
19
47
  - 'Rakefile'
@@ -25,27 +53,27 @@ Lint/AmbiguousRegexpLiteral:
25
53
  - 'spec/lib/dnsmadeeasy/credentials/api_keys_spec.rb'
26
54
  - 'spec/lib/dnsmadeeasy/runner_spec.rb'
27
55
 
28
- # Offense count: 3
56
+ # Offense count: 1
29
57
  # Configuration parameters: MaximumRangeSize.
30
58
  Lint/MissingCopEnableDirective:
31
59
  Exclude:
32
60
  - 'dnsmadeeasy.gemspec'
33
- - 'lib/dnsmadeeasy/runner.rb'
34
-
35
- # Offense count: 5
36
- # Cop supports --auto-correct.
37
- Lint/RedundantCopDisableDirective:
38
- Exclude:
39
- - 'lib/dnsmadeeasy/runner.rb'
40
61
 
41
62
  # Offense count: 1
42
63
  Lint/UselessAssignment:
43
64
  Exclude:
44
65
  - 'lib/dnsmadeeasy/runner.rb'
45
66
 
46
- # Offense count: 7
67
+ # Offense count: 8
68
+ # Configuration parameters: IgnoredMethods.
47
69
  Metrics/AbcSize:
48
- Max: 37
70
+ Max: 38
71
+
72
+ # Offense count: 10
73
+ # Configuration parameters: CountComments, ExcludedMethods.
74
+ # ExcludedMethods: refine
75
+ Metrics/BlockLength:
76
+ Max: 501
49
77
 
50
78
  # Offense count: 2
51
79
  # Configuration parameters: CountComments.
@@ -53,13 +81,14 @@ Metrics/ClassLength:
53
81
  Max: 250
54
82
 
55
83
  # Offense count: 2
84
+ # Configuration parameters: IgnoredMethods.
56
85
  Metrics/CyclomaticComplexity:
57
- Max: 12
86
+ Max: 8
58
87
 
59
- # Offense count: 11
88
+ # Offense count: 12
60
89
  # Configuration parameters: CountComments, ExcludedMethods.
61
90
  Metrics/MethodLength:
62
- Max: 29
91
+ Max: 32
63
92
 
64
93
  # Offense count: 3
65
94
  # Configuration parameters: CountKeywordArgs.
@@ -67,8 +96,24 @@ Metrics/ParameterLists:
67
96
  Max: 8
68
97
 
69
98
  # Offense count: 2
99
+ # Configuration parameters: IgnoredMethods.
70
100
  Metrics/PerceivedComplexity:
71
- Max: 14
101
+ Max: 9
102
+
103
+ # Offense count: 2
104
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
105
+ # AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
106
+ Naming/MethodParameterName:
107
+ Exclude:
108
+ - 'lib/dnsmadeeasy/api/client.rb'
109
+ - 'lib/dnsmadeeasy/runner.rb'
110
+
111
+ # Offense count: 2
112
+ # Configuration parameters: EnforcedStyle.
113
+ # SupportedStyles: snake_case, camelCase
114
+ Naming/VariableName:
115
+ Exclude:
116
+ - 'lib/dnsmadeeasy/api/client.rb'
72
117
 
73
118
  # Offense count: 1
74
119
  # Configuration parameters: AllowedChars.
@@ -78,7 +123,7 @@ Style/AsciiComments:
78
123
 
79
124
  # Offense count: 4
80
125
  # Cop supports --auto-correct.
81
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners.
126
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
82
127
  # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
83
128
  # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
84
129
  # FunctionalMethods: let, let!, subject, watch
@@ -109,11 +154,17 @@ Style/GuardClause:
109
154
  - 'lib/dnsmadeeasy/credentials/api_keys.rb'
110
155
  - 'lib/dnsmadeeasy/runner.rb'
111
156
 
112
- # Offense count: 1
113
- # Cop supports --auto-correct.
114
- Style/IfUnlessModifier:
157
+ # Offense count: 2
158
+ Style/MethodMissingSuper:
115
159
  Exclude:
116
- - 'lib/dnsmadeeasy/runner.rb'
160
+ - 'lib/dme.rb'
161
+ - 'lib/dnsmadeeasy.rb'
162
+
163
+ # Offense count: 2
164
+ Style/MissingRespondToMissing:
165
+ Exclude:
166
+ - 'lib/dme.rb'
167
+ - 'lib/dnsmadeeasy.rb'
117
168
 
118
169
  # Offense count: 3
119
170
  # Cop supports --auto-correct.
@@ -139,6 +190,12 @@ Style/SignalException:
139
190
  Exclude:
140
191
  - 'lib/dnsmadeeasy/api/client.rb'
141
192
 
193
+ # Offense count: 1
194
+ # Cop supports --auto-correct.
195
+ Style/StderrPuts:
196
+ Exclude:
197
+ - 'lib/dnsmadeeasy/runner.rb'
198
+
142
199
  # Offense count: 5
143
200
  # Cop supports --auto-correct.
144
201
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
@@ -166,9 +223,9 @@ Style/TrailingCommaInHashLiteral:
166
223
  Exclude:
167
224
  - 'spec/lib/dnsmadeeasy/api/client_spec.rb'
168
225
 
169
- # Offense count: 97
226
+ # Offense count: 96
170
227
  # Cop supports --auto-correct.
171
228
  # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
172
229
  # URISchemes: http, https
173
- Metrics/LineLength:
230
+ Layout/LineLength:
174
231
  Max: 305
@@ -9,8 +9,9 @@ rvm:
9
9
  - 2.4.3
10
10
  - 2.5.0
11
11
  - 2.6.5
12
+ - 2.7.1
12
13
  - jruby-9.1.15.0
13
- before_install: gem install bundler -v 2.0.2
14
+ before_install: gem install bundler
14
15
  before_script:
15
16
  - gem update --system
16
17
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
@@ -1,62 +1,83 @@
1
- [![Gem Version](https://badge.fury.io/rb/dnsmadeeasy.svg)](https://badge.fury.io/rb/dnsmadeeasy)
2
- [![Build Status](https://travis-ci.org/kigster/dnsmadeeasy.svg?branch=master)](https://travis-ci.org/kigster/dnsmadeeasy)
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/7a48648b482b5a5c9257/maintainability)](https://codeclimate.com/github/kigster/dnsmadeeasy/maintainability)
4
- [![Test Coverage](https://api.codeclimate.com/v1/badges/7a48648b482b5a5c9257/test_coverage)](https://codeclimate.com/github/kigster/dnsmadeeasy/test_coverage)
1
+ :doctype: book
5
2
 
3
+ :toc:
4
+ = DnsMadeEasy -- Ruby Client API Library
6
5
 
7
- # DnsMadeEasy Ruby Client API (Supporting SDK V2.0)
6
+ == Supporting Rest API SDK V2.0
8
7
 
9
- This is a fully featured REST API client for DnsMadeEasy provider. DME is an **excellent** provider, and is highly recommended for their ease of use, very solid API, and great customer support. They also offer free DNS failover with business accounts, which is highly recommended for the arrays of load balancers in front of your app.
8
+ NOTE: image:https://badge.fury.io/rb/dnsmadeeasy@2x.png["Gem Version", link="https://badge.fury.io/rb/dnsmadeeasy"]
10
9
 
11
- ## Usage
10
+ image:https://img.shields.io/gem/dt/dnsmadeeasy?style=for-the-badge[Downloads,link="https://rubygems.org/gems/dnsmadeeasy"]
11
+ image:https://img.shields.io/github/issues/kigster/dnsmadeeasy?style=for-the-badge&logo=appveyor[Github Issues,link="https://github.com/kigster/dnsmadeeasy/issues"]
12
+ image:https://img.shields.io/github/forks/kigster/dnsmadeeasy?style=for-the-badge&logo=appveyor[Forks,link="https://github.com/kigster/dnsmadeeasy/network/members"]
13
+ image:https://img.shields.io/github/stars/kigster/dnsmadeeasy?style=for-the-badge&logo=appveyor[Stars,link="https://github.com/kigster/dnsmadeeasy/stargazers"]
14
+ image:https://img.shields.io/github/license/kigster/dnsmadeeasy?style=for-the-badge&logo=appveyor[License,link="https://github.com/kigster/dnsmadeeasy/blob/master/LICENSE.txt"]
12
15
 
13
- **DnsMadeEasy** allows you to fetch, create, update DNS records, as long as you know your API key and the secret.
14
16
 
15
- ### Setting up Credentials
17
+ image:https://github.com/kigster/dnsmadeeasy/workflows/Ruby/badge.svg?branch=master[Github Build,link=https://github.com/kigster/dnsmadeeasy/actions?query=workflow%3ARuby]
18
+ image:https://travis-ci.org/kigster/dnsmadeeasy.svg?branch=master[Build Status,link=https://travis-ci.org/kigster/dnsmadeeasy]
16
19
 
17
- You can find your API Key and Secret on the [Account Settings Page](https://cp.dnsmadeeasy.com/account/info) of their UI.
20
+ image:https://api.codeclimate.com/v1/badges/7a48648b482b5a5c9257/maintainability[Maintainability,link=https://codeclimate.com/github/kigster/dnsmadeeasy/maintainability]
21
+ image:https://api.codeclimate.com/v1/badges/7a48648b482b5a5c9257/test_coverage[Test Coverage,link=https://codeclimate.com/github/kigster/dnsmadeeasy/test_coverage]
22
+
23
+ This is a fully featured REST API client for DnsMadeEasy provider. DME is an *excellent* provider, and is highly recommended for their ease of use, very solid API, and great customer support. They also offer free DNS failover with business accounts, which is highly recommended for the arrays of load balancers in front of your app.
24
+
25
+ == Usage
26
+
27
+ *DnsMadeEasy* allows you to fetch, create, update DNS records, as long as you know your API key and the secret.
28
+
29
+ === Setting up Credentials
30
+
31
+ You can find your API Key and Secret on the https://cp.dnsmadeeasy.com/account/info[Account Settings Page] of their UI.
18
32
 
19
33
  Once you have the key and the secret, you have several choices:
20
34
 
21
- 1. You can directly instantiate a new instance of the `Client` class, by passing your API key and API secrets as arguments:
35
+ * You can directly instantiate a new instance of the `Client` class, by passing your API key and API secrets as arguments:
22
36
 
23
- ```ruby
24
- require 'dnsmadeeasy'
25
- @client = DnsMadeEasy::Api::Client.new(api_key, api_secret)
26
- ```
37
+ +
38
+ [source,ruby]
39
+ ----
40
+ require 'dnsmadeeasy'
41
+ @client = DnsMadeEasy::Api::Client.new(api_key, api_secret)
42
+ ----
27
43
 
28
- 2. Or, you can use the `DnsMadeEasy.configure` method to configure the key/secret pair, and then use `DnsMadeEasy` namespace to call the methods:
44
+ . Or, you can use the `DnsMadeEasy.configure` method to configure the key/secret pair, and then use `DnsMadeEasy` namespace to call the methods:
45
+ +
46
+ [source,ruby]
47
+ ----
48
+ require 'dnsmadeeasy'
29
49
 
30
- ```ruby
31
- require 'dnsmadeeasy'
50
+ DnsMadeEasy.configure do |config|
51
+ config.api_key = 'XXXX'
52
+ config.api_secret = 'YYYY'
53
+ end
54
+
55
+ DnsMadeEasy.domains.data.first.name #=> 'moo.gamespot.com'
56
+ ----
57
+
58
+ . Configuring API keys as above is easy, and can be done using environment variables. Alternatively, it may be convenient to store credentials in a YAML file.
32
59
 
33
- DnsMadeEasy.configure do |config|
34
- config.api_key = 'XXXX'
35
- config.api_secret = 'YYYY'
36
- end
37
-
38
- DnsMadeEasy.domains.data.first.name #=> 'moo.gamespot.com'
39
- ```
40
-
41
- 3. Configuring API keys as above is easy, and can be done using environment variables. Alternatively, it may be convenient to store credentials in a YAML file.
42
-
43
- * If filename is not specified, there is default location where this file is searched, which is `~/.dnsmadeeasy/credentials.yml`.
44
- * If filename is provided, it will be read, and must conform to the following format:
45
-
46
- **Simple Credentials Format**
47
-
48
- ```yaml
60
+ ....
61
+ * If filename is not specified, there is default location where this file is searched, which is `~/.dnsmadeeasy/credentials.yml`.
62
+ * If filename is provided, it will be read, and must conform to the following format:
63
+ ....
64
+
65
+ *Simple Credentials Format*
66
+
67
+ [source,yaml]
68
+ ----
49
69
  # file: ~/.dnsmadeeasy/credentials.yml
50
70
  credentials:
51
71
  api_key: 2062259f-f666b17-b1fa3b48-042ad4030
52
72
  api_secret: 2265bc3-e31ead-95b286312e-c215b6a0
53
- ```
73
+ ----
54
74
 
55
- **Multi-Account Credentials Format**
56
-
57
- Below you see two accounts, with production key and secret being encrypted. See [further below](#encryption) about encrypting your key and secrets.
75
+ *Multi-Account Credentials Format*
58
76
 
59
- ```yaml
77
+ Below you see two accounts, with production key and secret being encrypted. See <<encryption,further below>> about encrypting your key and secrets.
78
+
79
+ [source,yaml]
80
+ ----
60
81
  accounts:
61
82
  - name: development
62
83
  default_account: true
@@ -68,11 +89,12 @@ Once you have the key and the secret, you have several choices:
68
89
  api_key: "BAhTOh1TeW06OkRhdGE6OldyYXBwZXJT............"
69
90
  api_secret: "BAhTOh1TeW06OkRhdGE6OldyYXBwZ............"
70
91
  encryption_key: spec/fixtures/sym.key
71
- ```
92
+ ----
93
+
94
+ You can use the following method to access both simple and multi-account YAML configurations:
72
95
 
73
- You can use the following method to access both simple and multi-account YAML configurations:
74
-
75
- ```ruby
96
+ [source,ruby]
97
+ ----
76
98
  require 'dnsmadeeasy'
77
99
  DnsMadeEasy.configure_from_file(file, account = nil, encryption_key = nil)
78
100
 
@@ -82,68 +104,63 @@ Once you have the key and the secret, you have several choices:
82
104
 
83
105
  # or with encrypted key passed as an argument to decrypt YAML values:
84
106
  DnsMadeEasy.configure_from_file(
85
- 'config/dme.yaml',
86
- 'production',
107
+ 'config/dme.yaml',
108
+ 'production',
87
109
  ENV['PRODUCTION_KEY'])
88
- ```
89
-
90
- 3. Finally, you can use `DME.credentials_from_file` method that, unlike the method above, uses hash arguments:
91
-
92
- ```ruby
93
- @creds = DnsMadeEasy.credentials_from_file(file: 'my-creds.yml',
94
- account: 'production',
110
+ ----
111
+
112
+ . Finally, you can use `DME.credentials_from_file` method that, unlike the method above, uses hash arguments:
113
+
114
+ [source,ruby]
115
+ ----
116
+ @creds = DnsMadeEasy.credentials_from_file(file: 'my-creds.yml',
117
+ account: 'production',
95
118
  encryption_key: 'MY_KEY')
96
119
  @creds.api_key # => ...
97
120
  @creds.api_secret # => ...
98
- ```
121
+ ----
99
122
 
100
- Method above simply returns the credentials instance, but does not "save" it as the default credentials like `configure_from_file`. Therefore, if you need to access multiple accounts at the same time, this method will help you maintain multiple credentials at the same time.
123
+ Method above simply returns the credentials instance, but does not "save" it as the default credentials like `configure_from_file`. Therefore, if you need to access multiple accounts at the same time, this method will help you maintain multiple credentials at the same time.
101
124
 
102
- ___
103
125
 
104
126
  Once you configure the keys, you can also use the shortcut module to save you some typing:
105
127
 
106
- ```ruby
128
+ [source,ruby]
129
+ ----
107
130
  require 'dnsmadeeasy/dme'
108
131
  DME.domains.data.first.name #=> 'moo.gamespot.com'
109
- ```
132
+ ----
110
133
 
111
- This has the advantage of being much shorter, but might conflict with existing modules in your Ruby VM.
134
+ This has the advantage of being much shorter, but might conflict with existing modules in your Ruby VM.
112
135
  In this case, just do not require `dnsmadeeasy/dme` and only require `dnsmadeeasy`, and you'll be fine.
113
136
  Otherwise, using `DME` is identical to using `DnsMadeEasy`, assuming you required `dnsmadeeasy/dme` file.
114
-
115
137
 
116
- ### Which Namespace to Use? What is `DME` versus `DnsMadeEasy`?
138
+ === Which Namespace to Use? What is `DME` versus `DnsMadeEasy`?
117
139
 
118
140
  Since `DnsMadeEasy` is a bit of a mouthful, we decided to offer (in addition to the standard `DnsMadeEasy` namespace) the abbreviated module `DME` that simply forwards all messages to the module `DnsMadeEasy`. If in your Ruby VM there is no conflicting top-level class `DME`, then you can `require 'dnsmadeeasy/dme'` to get all of the DnsMadeEasy client library functionality without having to type the full name once. You can even do `require 'dme'`.
119
141
 
120
- Whenever you require `dme` you also import the `DnsMadeEasy` namespace. **The opposite is not true.**
142
+ Whenever you require `dme` you also import the `DnsMadeEasy` namespace. *The opposite is not true.*
121
143
 
122
144
  So if you DO have a name clash with another top-level module `DME`, simply do `require 'dnsmadeeasy'` and none of the `DME` module namespace will be loaded.
123
145
 
124
- In a nutshell you have three ways to access all methods provided by the [`DnsMadeEasy::Api::Client`](http://www.rubydoc.info/gems/dnsmadeeasy/DnsMadeEasy/Api/Client) class:
146
+ In a nutshell you have three ways to access all methods provided by the http://www.rubydoc.info/gems/dnsmadeeasy/DnsMadeEasy/Api/Client[`DnsMadeEasy::Api::Client`] class:
125
147
 
126
- 1. Instantiate and use the client class directly,
127
- 2. Use the top-level module `DnsMadeEasy` with `require 'dnsmadeeasy'`
128
- 3. Use the shortened top-level module `DME` with `require 'dnsmadeeasy/dme'`
129
-
130
-
131
- ### Examples
148
+ . Instantiate and use the client class directly,
149
+ . Use the top-level module `DnsMadeEasy` with `require 'dnsmadeeasy'`
150
+ . Use the shortened top-level module `DME` with `require 'dnsmadeeasy/dme'`
151
+
152
+ === Examples
132
153
 
133
154
  Whether or not you are accessing a single account or multiple, it is recommended that you save your credentials (the API key and the secret) encrypted in the above mentioned file `~/.dnsmadeeasy/credentials.yml` (or any file of you preference).
134
- ___
135
155
 
136
- > **NOTE:**
137
- >
138
- > * DO NOT check that file into your repo!
139
- > * If you use encryption, do not check in your key!
140
- ___
156
+ WARNING: **DO NOT check that file into your repo! If you use encryption, do not check in your key!**
141
157
 
142
158
  The examples that follow assume credentials have already been configured, and so we explore the API.
143
159
 
144
160
  Using the `DME` module (or `DnsMadeEasy` if you prefer) you can access all of your records through the available API method calls, for example:
145
161
 
146
- ```ruby
162
+ [source, ruby]
163
+ ----
147
164
  IRB > require 'dme' #=> true
148
165
  # Or you can also do
149
166
  IRB > require 'dnsmadeeasy/dme' #=> true
@@ -161,7 +178,7 @@ IRB > DME.api_key
161
178
 
162
179
  IRB > DME.api_secret
163
180
  ⤷ "2265bc3-e31ead-95b286312e-c215b6a0"
164
-
181
+
165
182
  IRB > DME.domain('gamespot.live').delegateNameServers
166
183
  ⤷ #<Hashie::Array ["ns-125-c.gandi.net.", "ns-129-a.gandi.net.", "ns-94-b.gandi.net."]>
167
184
 
@@ -173,12 +190,13 @@ IRB > @client = DME.client
173
190
  @options={},
174
191
  @requests_remaining=149,
175
192
  @request_limit=150,
176
- @base_uri="https://api.dnsmadeeasy.com/V2.0">
177
- ```
193
+ @base_uri="https://api.dnsmadeeasy.com/V2.0">
194
+ ----
178
195
 
179
196
  Next, let's fetch a particular domain, get it's records and compute the counts for each record type, such as 'A', 'NS', etc.
180
197
 
181
- ```ruby
198
+ [source,ruby]
199
+ ----
182
200
  IRB > records = DME.records_for('gamespot.com')
183
201
  IRB > [ records.totalPages, records.totalRecords ]
184
202
  ⤷ [1, 33]
@@ -186,7 +204,7 @@ IRB > records.data.select{|f| f.type == 'A' }.map(&:name)
186
204
  ⤷ ["www", "vpn-us-east1", "vpn-us-east2", "staging", "yourmom"]
187
205
  IRB > types = records.data.map(&:type)
188
206
  ⤷ [....]
189
- IRB > require 'awesome_print'
207
+ IRB > require 'awesome_print'
190
208
  IRB > ap Hash[types.group_by {|x| x}.map {|k,v| [k,v.count]}]
191
209
  {
192
210
  "MX" => 2,
@@ -195,30 +213,33 @@ IRB > ap Hash[types.group_by {|x| x}.map {|k,v| [k,v.count]}]
195
213
  "NS" => 22,
196
214
  "A" => 5
197
215
  }
198
- ```
216
+ ----
199
217
 
200
- ### Return Value Types
218
+ === Return Value Types
201
219
 
202
- All public methods of this library return a Hash-like object, that is actually an instance of the class [`Hashie::Mash`](https://github.com/intridea/hashie). `Hashie::Mash` supports the very useful ability to reach deeply nested hash values via a chain of method calls instead of using a train of square brackets. You can always convert it to a regular hash either `to_hash` or `to_h` on an instance of a `Hashie::Mash` to get a pure hash representation.
220
+ All public methods of this library return a Hash-like object, that is actually an instance of the class https://github.com/intridea/hashie[`Hashie::Mash`]. `Hashie::Mash` supports the very useful ability to reach deeply nested hash values via a chain of method calls instead of using a train of square brackets. You can always convert it to a regular hash either `to_hash` or `to_h` on an instance of a `Hashie::Mash` to get a pure hash representation.
203
221
 
204
- > NOTE: `to_hash` converts the entire object to a regular hash, including the deeply nested hashes, while `to_h` only converts the primary object, but not the nested hashes. Here is an example below — in the first instance where we call `to_h` we are still able to call `.value` on the nested object, because only the top-level `Mash` has been converted into a `Hash`. In the second example, this call fails, because this method does not exist, and the value must be accessed via the square brackets:
205
- >
206
- > ```ruby
207
- > IRB > recs.to_h['data'].last.value
208
- > ⤷ "54.200.26.233"
209
- > IRB > recs.to_hash['data'].last.value
210
- > "NoMethodError: undefined method `value` for #<Hash:0x00007fe36fab0f68>"
211
- > IRB > recs.to_hash['data'].last['value']
212
- > ⤷ "54.200.26.233"
213
- > ```
222
+ ____
223
+ NOTE: `to_hash` converts the entire object to a regular hash, including the deeply nested hashes, while `to_h` only converts the primary object, but not the nested hashes. Here is an example below -- in the first instance where we call `to_h` we are still able to call `.value` on the nested object, because only the top-level `Mash` has been converted into a `Hash`. In the second example, this call fails, because this method does not exist, and the value must be accessed via the square brackets:
224
+ ____
214
225
 
215
- For more information on the actual JSON API, please refer to the [following PDF document](http://www.dnsmadeeasy.com/integration/pdf/API-Docv2.pdf).
226
+ [source,ruby]
227
+ ----
228
+ IRB > recs.to_h['data'].last.value
229
+ ⤷ "54.200.26.233"
230
+ IRB > recs.to_hash['data'].last.value
231
+ "NoMethodError: undefined method `value` for #<Hash:0x00007fe36fab0f68>"
232
+ IRB > recs.to_hash['data'].last['value']
233
+ ⤷ "54.200.26.233"
234
+ ----
216
235
 
217
- ## Available Actions
236
+ For more information on the actual JSON API, please refer to the http://www.dnsmadeeasy.com/integration/pdf/API-Docv2.pdf[following PDF document].
237
+
238
+ == Available Actions
218
239
 
219
240
  Here is the complete of all methods supported by the `DnsMadeEasy::Api::Client`:
220
241
 
221
- #### Domains
242
+ ==== Domains
222
243
 
223
244
  * `create_domain`
224
245
  * `create_domains`
@@ -227,7 +248,8 @@ Here is the complete of all methods supported by the `DnsMadeEasy::Api::Client`:
227
248
  * `domains`
228
249
  * `get_id_by_domain`
229
250
 
230
- #### Records
251
+ [discrete]
252
+ ==== Records
231
253
 
232
254
  * `records_for`
233
255
  * `all`
@@ -250,7 +272,9 @@ Here is the complete of all methods supported by the `DnsMadeEasy::Api::Client`:
250
272
  * `find_first`
251
273
  * `find_record_ids`
252
274
 
253
- #### Secondary Domains
275
+ [discrete]
276
+ ==== Secondary Domains
277
+
254
278
  * `secondary_domain`
255
279
  * `secondary_domains`
256
280
  * `get_id_by_secondary_domain`
@@ -259,22 +283,25 @@ Here is the complete of all methods supported by the `DnsMadeEasy::Api::Client`:
259
283
  * `update_secondary_domains`
260
284
  * `delete_secondary_domain`
261
285
 
262
- #### Secondary IpSets
286
+ [discrete]
287
+ ==== Secondary IpSets
288
+
263
289
  * `secondary_ip_set`
264
290
  * `secondary_ip_sets`
265
291
  * `create_secondary_ip_set`
266
292
  * `update_secondary_ip_set`
267
293
  * `delete_secondary_ip_set`
268
294
 
269
- <a name="encryption"></a>
295
+ +++<a name="encryption">++++++</a>+++
270
296
 
271
- ### Encryption
297
+ === Encryption
272
298
 
273
- It was mentioned above that the credentials YAML file may contain encrypted values. This facility is provided by the encryption gem [Sym](https://github.com/kigster/sym).
299
+ It was mentioned above that the credentials YAML file may contain encrypted values. This facility is provided by the encryption gem https://github.com/kigster/sym[Sym].
274
300
 
275
301
  In order to encrypt your values, you need to perform the following steps:
276
302
 
277
- ```bash
303
+ [source,bash]
304
+ ----
278
305
  gem install sym
279
306
 
280
307
  # let's generate a new key and save it to a file:
@@ -283,13 +310,14 @@ sym -g -o my.key
283
310
  # if you are on Mac OS-X, you can import the key into the KeyChain.
284
311
  # this creates an entry in the keychain named 'my.key' that can be used later.
285
312
  sym -g -x my.key
286
- ```
313
+ ----
287
314
 
288
- Once you have the key generated, first, **make sure to never commit this to any repo!**. You can use 1Password for it, or something like that.
315
+ Once you have the key generated, first, *make sure to never commit this to any repo!*. You can use 1Password for it, or something like that.
289
316
 
290
317
  Let's encrypt our actual API key:
291
318
 
292
- ```bash
319
+ [source,bash]
320
+ ----
293
321
  api_key="12345678-a8f8-4466-ffff-2324aaaa9098"
294
322
  api_secret="43009899-abcc-ffcc-eeee-09f809808098"
295
323
  sym -ck my.key -e -s "${api_key}"
@@ -297,42 +325,20 @@ sym -ck my.key -e -s "${api_key}"
297
325
 
298
326
  # On a mac, you can copy it to clipboard:
299
327
  sym -ck my.key -e -s "${api_secret}" | pbcopy
300
- ```
328
+ ----
301
329
 
302
- Now, you place the encrypted values in the YAML file, and you can save "my.key" as the value against `encryption_key:` at the same level as the `api_key` and `api_secret` in the YAML file. This value can either point to a file path, or be a keychain name, or even a name of an environment variable. For full details, please see [sym documentation](https://github.com/kigster/sym#using-sym-with-the-command-line).
330
+ Now, you place the encrypted values in the YAML file, and you can save "my.key" as the value against `encryption_key:` at the same level as the `api_key` and `api_secret` in the YAML file. This value can either point to a file path, or be a keychain name, or even a name of an environment variable. For full details, please see https://github.com/kigster/sym#using-sym-with-the-command-line[sym documentation].
303
331
 
304
- ## CLI Client
332
+ == CLI Client
305
333
 
306
334
  This library offers a simple CLI client `dme` that maps the command line arguments to method arguments for corresponding actions:
307
335
 
308
- ```bash
309
- ❯ dme --help
310
- Usage:
311
- # Execute an API call:
312
- dme [ --json | --yaml ] operation [ arg1 arg2 ... ]
313
-
314
- # Print suported operations:
315
- dme op[erations]
316
-
317
- Credentials:
318
- Store your credentials in a YAML file
319
- /Users/kig/.dnsmadeeasy/credentials.yml as follows:
320
-
321
- credentials:
322
- api_key: XXXX
323
- api_secret: YYYY
324
-
325
- Examples:
326
- dme domain moo.com
327
- dme --json domain moo.com
328
- dme find_all moo.com A www
329
- dme find_first moo.com CNAME vpn-west
330
- dme --yaml find_first moo.com CNAME vpn-west
331
- ```
336
+ image:.dme-help.png[Usage,width="80%",border="2"]
332
337
 
333
338
  You can run `dme operations` to see the supported list of operations:
334
339
 
335
- ```bash
340
+ [source,bash]
341
+ ----
336
342
  ❯ dme op
337
343
  Actions:
338
344
  Checkout the README and RubyDoc for the arguments to each operation,
@@ -380,17 +386,19 @@ Valid Operations Are:
380
386
  update_records
381
387
  update_secondary_domains
382
388
  update_secondary_ip_set
383
- ```
389
+ ----
384
390
 
385
391
  For example:
386
392
 
387
- ```bash
393
+ [source,bash]
394
+ ----
388
395
  ❯ dme domains moo.com
389
- ```
396
+ ----
390
397
 
391
398
  is equivalent to `DME.domains("moo.com")`. You can use any operation listed above, and output the result in either `YAML` or `JSON` (in addition to the default "awesome_print"), for example:
392
399
 
393
- ```bash
400
+ [source,bash]
401
+ ----
394
402
  ❯ dme --yaml find_all moo.com www CNAME
395
403
  ---
396
404
  - dynamicDns: false
@@ -406,150 +414,172 @@ is equivalent to `DME.domains("moo.com")`. You can use any operation listed abov
406
414
  value: ec2-54-202-251-7.us-west-2.compute.amazonaws.com
407
415
  id: 43509989
408
416
  type: CNAME
409
- ```
417
+ ----
410
418
 
411
- ### Managing Domains
419
+ === Managing Domains
412
420
 
413
- > NOTE: below we can be using `@client` instantiated with given key and secret, or
414
- > `DME` or `DnsMadeEasy` module.
421
+ NOTE: below we can be using `@client` instantiated with given key and secret, or
422
+ `DME` or `DnsMadeEasy` module.
415
423
 
416
424
  To retrieve all domains:
417
425
 
418
- ```ruby
426
+ [source,ruby]
427
+ ----
419
428
  require 'dnsmadeeasy/dme'
420
429
  DME.domains
421
- ```
430
+ ----
422
431
 
423
432
  To retreive the id of a domain by the domain name:
424
433
 
425
- ```ruby
434
+ [source,ruby]
435
+ ----
426
436
  DME.get_id_by_domain('test.io')
427
- ```
437
+ ----
428
438
 
429
439
  To retrieve the full domain record by domain name:
430
440
 
431
- ```ruby
441
+ [source,ruby]
442
+ ----
432
443
  DME.domain('test.io')
433
- ```
444
+ ----
434
445
 
435
446
  To create a domain:
436
447
 
437
- ```ruby
448
+ [source,ruby]
449
+ ----
438
450
  DME.create_domain('test.io')
439
451
  # Multiple domains can be created by:
440
452
  DME.create_domains(%w[test.io moo.re])
441
- ```
453
+ ----
442
454
 
443
455
  To delete a domain:
444
456
 
445
- ```ruby
457
+ [source,ruby]
458
+ ----
446
459
  DME.delete_domain ('test.io')
447
- ```
460
+ ----
448
461
 
449
- ### Managing Secondary Domains
462
+ === Managing Secondary Domains
450
463
 
451
464
  To retrieve all secondary domains:
452
- ```ruby
465
+
466
+ [source,ruby]
467
+ ----
453
468
  DME.secondary_domains
454
- ```
469
+ ----
455
470
 
456
471
  To retrieve secondary domain by id:
457
472
 
458
- ```ruby
473
+ [source,ruby]
474
+ ----
459
475
  DME.secondary_domain(domain_id)
460
- ```
476
+ ----
461
477
 
462
478
  To retrieve the id of a domain by the secondary domain name:
463
479
 
464
- ```ruby
480
+ [source,ruby]
481
+ ----
465
482
  DME.get_id_by_secondary_domain('test.io')
466
- ```
483
+ ----
467
484
 
468
485
  To create a secondary domain:
469
486
 
470
- ```ruby
487
+ [source,ruby]
488
+ ----
471
489
  # IP_SET_ID is id of ip_set you want to associate domain with
472
490
  DME.create_secondary_domain('test.io', IP_SET_ID)
473
491
 
474
492
  # Multiple domains can be created by:
475
493
  DME.create_secondary_domains(%w[test.io moo.re], IP_SET_ID)
476
- ```
494
+ ----
477
495
 
478
496
  To update a secondary domain:
479
497
 
480
- ```ruby
481
- # IP_SET_ID is id of ip_set you want to associate
482
- # DOMAIN_ID is id of domain
498
+ [source,ruby]
499
+ ----
500
+ # IP_SET_ID is id of ip_set you want to associate
501
+ # DOMAIN_ID is id of domain
483
502
  DME.update_secondary_domains([DOMAIN_ID], IP_SET_ID)
484
- ```
503
+ ----
485
504
 
486
505
  To delete a secondary domain:
487
506
 
488
- ```ruby
507
+ [source,ruby]
508
+ ----
489
509
  DME.delete_secondary_domain('test.io')
490
- ```
510
+ ----
491
511
 
492
- ### Managing Secondary IpSets
512
+ === Managing Secondary IpSets
493
513
 
494
514
  To retrieve all secondary IpSets:
495
- ```ruby
515
+
516
+ [source,ruby]
517
+ ----
496
518
  DME.secondary_ip_sets
497
- ```
519
+ ----
498
520
 
499
521
  To retrieve single ipSet:
500
522
 
501
- ```ruby
523
+ [source,ruby]
524
+ ----
502
525
  DME.secondary_ip_set(IP_SET_ID)
503
- ```
526
+ ----
504
527
 
505
528
  To create an ipSet:
506
529
 
507
- ```ruby
530
+ [source,ruby]
531
+ ----
508
532
  # IP_LIST is list of ips to be associated with this ip_set, like %w[8.8.8.8, 1.1.1.1]
509
533
  DME.create_secondary_ip_set('ip-set-name', IP_LIST)
510
- ```
534
+ ----
511
535
 
512
536
  To update an ipSet:
513
537
 
514
- ```ruby
538
+ [source,ruby]
539
+ ----
515
540
  DME.update_secondary_ip_set(IP_SET_ID, 'ip-list-name', IP_LIST)
516
- ```
541
+ ----
517
542
 
518
543
  To delete an ipSet:
519
544
 
520
- ```ruby
545
+ [source,ruby]
546
+ ----
521
547
  DME.delete_secondary_ip_set(IP_SET_ID)
522
- ```
548
+ ----
523
549
 
524
- ### Managing Records
550
+ === Managing Records
525
551
 
526
552
  To retrieve all records for a given domain name:
527
553
 
528
- ```ruby
554
+ [source,ruby]
555
+ ----
529
556
  DME.all('test.io')
530
- ```
557
+ ----
531
558
 
532
559
  To find the record id for a given domain, name, and type:
533
560
 
534
561
  This finds all of the IDs matching 'woah.test.io' type 'A':
535
562
 
536
- ```ruby
563
+ [source,ruby]
564
+ ----
537
565
  DME.find_record_ids ('test.io', 'woah', 'A')
538
566
  # => [ 234234, 2342345 ]
539
- ```
567
+ ----
540
568
 
541
- ```ruby
569
+ [source,ruby]
570
+ ----
542
571
  # To delete a record by domain name and record id (the record id can be retrieved from `find_record_id`:
543
572
  DME.delete_record ('test.io', 123)
544
573
  # To delete multiple records:
545
574
  DME.delete_records ('test.io', [123, 143])
546
575
  # To delete all records in the domain:
547
576
  DME.delete_all_records ('test.io')
548
- ```
577
+ ----
549
578
 
550
579
  To create records of various types:
551
580
 
552
- ```ruby
581
+ [source,ruby]
582
+ ----
553
583
  # The generic method:
554
584
  DME.create_record ('test.io', 'woah', 'A', '127.0.0.1', { 'ttl' => '60' })
555
585
 
@@ -561,32 +591,35 @@ DME.create_txt_record ('test.io', 'woah', '127.0.0.1', {})
561
591
  DME.create_cname_record ('test.io', 'woah', '127.0.0.1', {})
562
592
  DME.create_ns_record ('test.io', 'woah', '127.0.0.1', {})
563
593
  DME.create_spf_record ('test.io', 'woah', '127.0.0.1', {})
564
- ```
594
+ ----
565
595
 
566
- #### Specialized Record Types
596
+ ==== Specialized Record Types
567
597
 
568
598
  Below are the method calls for `MX`, `SRV`, and `HTTPRED` types:
569
599
 
570
- ```ruby
600
+ [source,ruby]
601
+ ----
571
602
  # Arguments are: domain_name, name, priority, value, options = {}
572
603
  DME.create_mx_record ('test.io', 'woah', 5, '127.0.0.1', {})
573
604
  # Arguments are: domain_name, name, priority, weight, port, value, options = {}
574
605
  DME.create_srv_record ('test.io', 'woah', 1, 5, 80, '127.0.0.1', {})
575
- # Arguments are: domain_name, name, value, redirectType,
606
+ # Arguments are: domain_name, name, value, redirectType,
576
607
  DME.create_httpred_record('test.io', 'woah', '127.0.0.1', 'STANDARD - 302',
577
608
  # description, keywords, title, options = {}
578
609
  'a description', 'keywords', 'a title', {})
579
- ```
610
+ ----
580
611
 
581
612
  To update a record:
582
613
 
583
- ```ruby
614
+ [source,ruby]
615
+ ----
584
616
  DME.update_record('test.io', 123, 'woah', 'A', '127.0.1.1', { 'ttl' => '60' })
585
- ```
617
+ ----
586
618
 
587
619
  To update several records:
588
620
 
589
- ```ruby
621
+ [source,ruby]
622
+ ----
590
623
  DME.update_records('test.io',
591
624
  [
592
625
  { 'id' => 123,
@@ -595,68 +628,63 @@ DME.update_records('test.io',
595
628
  'value'=> '127.0.0.1'
596
629
  }
597
630
  ], { 'ttl' => '60' })
598
-
599
- ```
631
+ ----
600
632
 
601
633
  To get the number of API requests remaining after a call:
602
634
 
603
- ```ruby
635
+ [source,ruby]
636
+ ----
604
637
  DME.requests_remaining
605
638
  #=> 19898
606
- ```
607
- > NOTE: Information is not available until an API call has been made
639
+ ----
640
+
641
+ NOTE: Information is not available until an API call has been made
608
642
 
609
643
  To get the API request total limit after a call:
610
644
 
611
- ```ruby
645
+ [source,ruby]
646
+ ----
612
647
  DME.request_limit
613
648
  #=> 2342
614
- ```
615
- > NOTE: Information is not available until an API call has been made
649
+ ----
616
650
 
651
+ NOTE: Information is not available until an API call has been made
617
652
 
618
- ## Installation
653
+ == Installation
619
654
 
620
655
  Add this line to your application's Gemfile:
621
656
 
622
- ```ruby
657
+ [source,ruby]
658
+ ----
623
659
  gem 'dnsmadeeasy'
624
- ```
660
+ ----
625
661
 
626
662
  And then execute:
627
663
 
628
- ```
629
- $ bundle
630
- ```
664
+ $ bundle
631
665
 
632
666
  Or install it yourself:
633
667
 
634
- ```
635
- $ gem install dnsmadeeasy
636
- ```
668
+ $ gem install dnsmadeeasy
637
669
 
638
-
639
- ## Development
670
+ == Development
640
671
 
641
672
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exe rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
642
673
 
643
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, up date the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
644
-
645
- ## Acknowledgements
646
-
647
- The current maintainer [Konstantin Gredeskoul](https://github.com/kigster) wishes to thank:
648
-
649
- * Arnoud Vermeer for the original `dnsmadeeasy-rest-api` gem
650
- * Andre Arko, Paul Henry, James Hart formerly of [Wanelo](wanelo.com) fame, for bringing the REST API gem up to the level.
651
- * Phil Cohen, who graciously transferred the ownership of the name of this gem on RubyGems.org to the current maintainer.
674
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, up date the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to https://rubygems.org[rubygems.org].
652
675
 
676
+ == Acknowledgements
653
677
 
654
- ## Contributing
678
+ The current maintainer https://github.com/kigster[Konstantin Gredeskoul] wishes to thank:
655
679
 
656
- Bug reports and pull requests are welcome on GitHub at [https://github.com/kigster/dnsmadeeasy](https://github.com/kigster/dnsmadeeasy).
680
+ * Arnoud Vermeer for the original `dnsmadeeasy-rest-api` gem
681
+ * Andre Arko, Paul Henry, James Hart formerly of link:wanelo.com[Wanelo] fame, for bringing the REST API gem up to the level.
682
+ * Phil Cohen, who graciously transferred the ownership of the name of this gem on RubyGems.org to the current maintainer.
657
683
 
658
- ## License
684
+ == Contributing
659
685
 
660
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
686
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kigster/dnsmadeeasy.
661
687
 
688
+ == License
662
689
 
690
+ The gem is available as open source under the terms of the http://opensource.org/licenses/MIT[MIT License].